You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by "Pepijn Van Eeckhoudt (JIRA)" <ji...@apache.org> on 2010/03/12 14:44:27 UTC

[jira] Created: (BUILDR-398) FileUtils#sh does not work correctly on windows

FileUtils#sh does not work correctly on windows
-----------------------------------------------

                 Key: BUILDR-398
                 URL: https://issues.apache.org/jira/browse/BUILDR-398
             Project: Buildr
          Issue Type: Bug
          Components: Core features
    Affects Versions: 1.3.5
            Reporter: Pepijn Van Eeckhoudt
            Priority: Critical
             Fix For: 1.4


the sh method attempts to 'cd' to Dir.pwd before executing the actual command. This does not work correctly on Windows/JRuby 1.4. File::SEPARATOR returns '/' on this platform. When system tries to 'cd' to a path with a '/' on Windows the operation fails. The attached patch ensures the separators are '\' instead.

Also cd on windows changes the current directory for a particular drive. When changing to another drive the '/d' option should be included. This is also included in the attached patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (BUILDR-398) FileUtils#sh does not work correctly on windows

Posted by "Antoine Toulme (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BUILDR-398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antoine Toulme resolved BUILDR-398.
-----------------------------------

    Resolution: Fixed

Fixed by Alex just now.

Applied fix to "else" portion of "if Buildr::Util.java_platform?" condition.

Sending        lib/buildr/core/util.rb
Transmitting file data .
Committed revision 933023.

> FileUtils#sh does not work correctly on windows
> -----------------------------------------------
>
>                 Key: BUILDR-398
>                 URL: https://issues.apache.org/jira/browse/BUILDR-398
>             Project: Buildr
>          Issue Type: Bug
>          Components: Core features
>    Affects Versions: 1.3.5
>            Reporter: Pepijn Van Eeckhoudt
>            Assignee: Alex Boisvert
>            Priority: Critical
>             Fix For: 1.4
>
>         Attachments: fileutils_sh.patch
>
>
> the sh method attempts to 'cd' to Dir.pwd before executing the actual command. This does not work correctly on Windows/JRuby 1.4. File::SEPARATOR returns '/' on this platform. When system tries to 'cd' to a path with a '/' on Windows the operation fails. The attached patch ensures the separators are '\' instead.
> Also cd on windows changes the current directory for a particular drive. When changing to another drive the '/d' option should be included. This is also included in the attached patch.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Assigned: (BUILDR-398) FileUtils#sh does not work correctly on windows

Posted by "Antoine Toulme (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BUILDR-398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antoine Toulme reassigned BUILDR-398:
-------------------------------------

    Assignee: Alex Boisvert

Alex, do you want to take a second look at this ? Alternatively, I can ask questions on the ruby IRC channel, see what to do.

> FileUtils#sh does not work correctly on windows
> -----------------------------------------------
>
>                 Key: BUILDR-398
>                 URL: https://issues.apache.org/jira/browse/BUILDR-398
>             Project: Buildr
>          Issue Type: Bug
>          Components: Core features
>    Affects Versions: 1.3.5
>            Reporter: Pepijn Van Eeckhoudt
>            Assignee: Alex Boisvert
>            Priority: Critical
>             Fix For: 1.4
>
>         Attachments: fileutils_sh.patch
>
>
> the sh method attempts to 'cd' to Dir.pwd before executing the actual command. This does not work correctly on Windows/JRuby 1.4. File::SEPARATOR returns '/' on this platform. When system tries to 'cd' to a path with a '/' on Windows the operation fails. The attached patch ensures the separators are '\' instead.
> Also cd on windows changes the current directory for a particular drive. When changing to another drive the '/d' option should be included. This is also included in the attached patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (BUILDR-398) FileUtils#sh does not work correctly on windows

Posted by "Antoine Toulme (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BUILDR-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12845114#action_12845114 ] 

Antoine Toulme commented on BUILDR-398:
---------------------------------------

What does Dir.pwd return exactly ? It should contain the right separators on Windows.

The addition of \d is useful though.

> FileUtils#sh does not work correctly on windows
> -----------------------------------------------
>
>                 Key: BUILDR-398
>                 URL: https://issues.apache.org/jira/browse/BUILDR-398
>             Project: Buildr
>          Issue Type: Bug
>          Components: Core features
>    Affects Versions: 1.3.5
>            Reporter: Pepijn Van Eeckhoudt
>            Priority: Critical
>             Fix For: 1.4
>
>         Attachments: fileutils_sh.patch
>
>
> the sh method attempts to 'cd' to Dir.pwd before executing the actual command. This does not work correctly on Windows/JRuby 1.4. File::SEPARATOR returns '/' on this platform. When system tries to 'cd' to a path with a '/' on Windows the operation fails. The attached patch ensures the separators are '\' instead.
> Also cd on windows changes the current directory for a particular drive. When changing to another drive the '/d' option should be included. This is also included in the attached patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (BUILDR-398) FileUtils#sh does not work correctly on windows

Posted by "Pepijn Van Eeckhoudt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BUILDR-398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pepijn Van Eeckhoudt reopened BUILDR-398:
-----------------------------------------


The issue seems to apply to Ruby in general. From the information I could find via google I've come to the conclusion that File.SEPARATOR is always set to '/' regardless of platform. Paths in Ruby are also always '/' separated. This is supposedly so to ease cross-platform portability.

As a result, this patch should be applied for all Ruby implementations; not just JRuby.

> FileUtils#sh does not work correctly on windows
> -----------------------------------------------
>
>                 Key: BUILDR-398
>                 URL: https://issues.apache.org/jira/browse/BUILDR-398
>             Project: Buildr
>          Issue Type: Bug
>          Components: Core features
>    Affects Versions: 1.3.5
>            Reporter: Pepijn Van Eeckhoudt
>            Priority: Critical
>             Fix For: 1.4
>
>         Attachments: fileutils_sh.patch
>
>
> the sh method attempts to 'cd' to Dir.pwd before executing the actual command. This does not work correctly on Windows/JRuby 1.4. File::SEPARATOR returns '/' on this platform. When system tries to 'cd' to a path with a '/' on Windows the operation fails. The attached patch ensures the separators are '\' instead.
> Also cd on windows changes the current directory for a particular drive. When changing to another drive the '/d' option should be included. This is also included in the attached patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (BUILDR-398) FileUtils#sh does not work correctly on windows

Posted by "Pepijn Van Eeckhoudt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BUILDR-398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pepijn Van Eeckhoudt updated BUILDR-398:
----------------------------------------

    Attachment: fileutils_sh.patch

> FileUtils#sh does not work correctly on windows
> -----------------------------------------------
>
>                 Key: BUILDR-398
>                 URL: https://issues.apache.org/jira/browse/BUILDR-398
>             Project: Buildr
>          Issue Type: Bug
>          Components: Core features
>    Affects Versions: 1.3.5
>            Reporter: Pepijn Van Eeckhoudt
>            Priority: Critical
>             Fix For: 1.4
>
>         Attachments: fileutils_sh.patch
>
>
> the sh method attempts to 'cd' to Dir.pwd before executing the actual command. This does not work correctly on Windows/JRuby 1.4. File::SEPARATOR returns '/' on this platform. When system tries to 'cd' to a path with a '/' on Windows the operation fails. The attached patch ensures the separators are '\' instead.
> Also cd on windows changes the current directory for a particular drive. When changing to another drive the '/d' option should be included. This is also included in the attached patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (BUILDR-398) FileUtils#sh does not work correctly on windows

Posted by "Alex Boisvert (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BUILDR-398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Boisvert resolved BUILDR-398.
----------------------------------

    Resolution: Fixed

I applied the patch *but* moved it under the "if Buildr::Util.java_platform?" condition since, if I understood correctly, it applies only to JRuby.   Please reopen if this isn't the case.

thanks!

Sending        CHANGELOG
Sending        lib/buildr/core/util.rb
Transmitting file data ..
Committed revision 922990.


> FileUtils#sh does not work correctly on windows
> -----------------------------------------------
>
>                 Key: BUILDR-398
>                 URL: https://issues.apache.org/jira/browse/BUILDR-398
>             Project: Buildr
>          Issue Type: Bug
>          Components: Core features
>    Affects Versions: 1.3.5
>            Reporter: Pepijn Van Eeckhoudt
>            Priority: Critical
>             Fix For: 1.4
>
>         Attachments: fileutils_sh.patch
>
>
> the sh method attempts to 'cd' to Dir.pwd before executing the actual command. This does not work correctly on Windows/JRuby 1.4. File::SEPARATOR returns '/' on this platform. When system tries to 'cd' to a path with a '/' on Windows the operation fails. The attached patch ensures the separators are '\' instead.
> Also cd on windows changes the current directory for a particular drive. When changing to another drive the '/d' option should be included. This is also included in the attached patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (BUILDR-398) FileUtils#sh does not work correctly on windows

Posted by "Pepijn Van Eeckhoudt (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BUILDR-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12845116#action_12845116 ] 

Pepijn Van Eeckhoudt commented on BUILDR-398:
---------------------------------------------

On my configuration (WinXP, JRuby 1.4) it returns 'c:/windows' for instance. Strings with forward slashes in other words. This might be a bug in JRuby, but it causes sh to fail. Unlike many other commands, cd on windows (XP at least) does not accept paths with forward slashes.

> FileUtils#sh does not work correctly on windows
> -----------------------------------------------
>
>                 Key: BUILDR-398
>                 URL: https://issues.apache.org/jira/browse/BUILDR-398
>             Project: Buildr
>          Issue Type: Bug
>          Components: Core features
>    Affects Versions: 1.3.5
>            Reporter: Pepijn Van Eeckhoudt
>            Priority: Critical
>             Fix For: 1.4
>
>         Attachments: fileutils_sh.patch
>
>
> the sh method attempts to 'cd' to Dir.pwd before executing the actual command. This does not work correctly on Windows/JRuby 1.4. File::SEPARATOR returns '/' on this platform. When system tries to 'cd' to a path with a '/' on Windows the operation fails. The attached patch ensures the separators are '\' instead.
> Also cd on windows changes the current directory for a particular drive. When changing to another drive the '/d' option should be included. This is also included in the attached patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (BUILDR-398) FileUtils#sh does not work correctly on windows

Posted by "Pepijn Van Eeckhoudt (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BUILDR-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12845125#action_12845125 ] 

Pepijn Van Eeckhoudt commented on BUILDR-398:
---------------------------------------------

It's a bit old but this discussion (http://www.ruby-forum.com/topic/50137) seems to conclude that Ruby will use forward slashes regardless of platform and that a gsub should be used when interacting with external applications. So basically what I did in the attached patch.

> FileUtils#sh does not work correctly on windows
> -----------------------------------------------
>
>                 Key: BUILDR-398
>                 URL: https://issues.apache.org/jira/browse/BUILDR-398
>             Project: Buildr
>          Issue Type: Bug
>          Components: Core features
>    Affects Versions: 1.3.5
>            Reporter: Pepijn Van Eeckhoudt
>            Priority: Critical
>             Fix For: 1.4
>
>         Attachments: fileutils_sh.patch
>
>
> the sh method attempts to 'cd' to Dir.pwd before executing the actual command. This does not work correctly on Windows/JRuby 1.4. File::SEPARATOR returns '/' on this platform. When system tries to 'cd' to a path with a '/' on Windows the operation fails. The attached patch ensures the separators are '\' instead.
> Also cd on windows changes the current directory for a particular drive. When changing to another drive the '/d' option should be included. This is also included in the attached patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.