Patches: Browse | Submit New | Admin

[#23003] Rake install task breaks on spaces

Date:
2008-11-26 09:58
Priority:
3
Submitted By:
Charlie Savage (cfis)
Assigned To:
Daniel Berger (djberg96)
Category:
other
State:
Closed
Summary:
Rake install task breaks on spaces

Detailed description
rake_builder.rb, line 29, builds a rake command to execute to install a gem:

cmd += " RUBYARCHDIR=#{dest_path} RUBYLIBDIR=#{dest_path}" # ENV is frozen

The problem is that this breaks with paths that have spaces.  For example:

gem install -i C:\Program Files ruby-prof

Creates this rake command:

rake RUBYARCHDIR=C:/Program Files/gems/ruby-prof-0.7.1-x86-mswin32-60/lib
RUBYLIBDIR=C:/Program Files/gems/ruby-prof-0.7.1-x86-mswin32-60/lib

Which executes as this:

rake RUBYARCHDIR=Files/gems/ruby-prof-0.7.1-x86-mswin32-60/lib
RUBYLIBDIR=Files/gems/ruby-prof-0.7.1-x86-mswin32-60/lib

And thus fails.

To fix, the cmd line needs to enclose paths in quotes, like this:

cmd += " RUBYARCHDIR=\"#{dest_path}\" RUBYLIBDIR=\"#{dest_path}\"" # ENV is frozen

Thanks - Charlie

Add A Comment: Notepad

Please login


Followup

Message
Date: 2009-01-02 19:03
Sender: Charlie Savage

Hi Dan,

Sounds good - thanks.

Charlie
Date: 2009-01-02 12:55
Sender: Daniel Berger

Ok, I've split the difference. The dest_path is now quoted if
it contains spaces.

Fixed in trunk. Thanks for the clarification and the report.

Regards,

Dan
Date: 2009-01-02 10:27
Sender: Darren Schreiber

I stumbled upon this when I was NOT using the -i flag. It happens
when someone installs Ruby and Rails in C:\Program Files\Ruby .

Most people are probably not running into this because, on Windows,
the default install is to C:\Ruby

But it is definitely an issue that occurs with spaces in the
path. The suggested fix works and does not appear to break anything
else.
Date: 2009-01-02 09:08
Sender: Charlie Savage

Hi Dan,

The problem is that doing a default 'gem install' fails if
you have a space in the path.  

My example using 'gem install -i' was simply showing the
issue.  It seems unreasonable to force users to specify the
-i argument just because they have a space in their path.

Charlie 
Date: 2008-12-31 05:05
Sender: Daniel Berger

Upon further review, this is an issue with the way you specified
your arguments on the command line, i.e. you never quoted the
path.

It should be gem install -i "C:\Program Files"
ruby-prof.

Regards,

Dan
Date: 2008-12-29 04:02
Sender: Darren Schreiber

This fix worked for me.
Date: 2008-12-25 09:36
Sender: Daniel Berger

Looks good to me. I vote to apply.

Dan

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
close_date2009-01-02 19:032009-01-02 19:03cfis
status_idOpen2009-01-02 12:55djberg96
resolution_idRejected2009-01-02 12:55djberg96
close_date2009-01-02 12:552009-01-02 12:55djberg96
status_idClosed2009-01-02 09:08cfis
close_date2008-12-31 05:052008-12-31 05:05djberg96
resolution_idNone2008-12-31 05:05djberg96
category_idNone2008-12-31 05:05djberg96
artifact_group_idNone2008-12-31 05:05djberg96
assigned_tonone2008-12-31 05:05djberg96
status_idOpen2008-12-31 05:05djberg96