System with multiple arguments fails on Windows when there are umlauts in the PATH

We have recently discovered a nasty bug in our software, in which it
failed to call one of the commands that come with it using system.
The bug only occurs if it is installed in a directory containing an
umlaut.
After some debugging we have come to the following conclusions:

  1. On Windows system is not able to invoke applications which live in a
    directory containing an umlaut even though they are in the PATH.
  2. This is only the case if system is invoked with multiple arguments.
    Both the single-argument version of system as well as backticks work
    as expected.

We reduced the problem to a minimal test case and could reproduce on
Windows 7 with ruby 1.8.7 using the following steps:

  1. Create a directory containing umlauts, e.g. c:\f

On Feb 13, 3:06am, Sebastian H. [email protected]
wrote:

We have recently discovered a nasty bug in our software, in which it
failed to call one of the commands that come with it using system.

Please make it more prominent the version of Ruby you’re talking
because hunting it down to the middle of the post make it hard to
discard or accept there is a bug and in which version of Ruby.

[…]

What you report here is something that was found on 1.8.x codebase and
that has been already solved under 1.9.2

Have you tried 1.9.2? Support for unicode directories has already been
implemented and system with single or multiple parameters should work.

[…]

Using “bla someargument” on the command line works as expected. So does
calling system(“bla someargument”) or bla someargument in ruby. However
system(“bla”, “someargument”) simply returns false without any further
error message.

system() with multiple arguments is flawed in 1.8.x, but solved in
1.9.1 and 1.9.2

Rake contains alt_system functionality that allow Ruby 1.8.7 avoid the
error you’re mentioning. Perhaps you want to take a look to it if
you’re stuck with Ruby 1.8.7

Can someone confirm this behavior and that this is indeed a bug in ruby and
not some error on our part? Is this a known bug? Does it still exist in ruby
1.9? Should I file a bug report?

Confirmed above, bug fixed, not present in 1.9.x

Currently we worked around this by switching to the single-argument
version of
system and placing quotes around the arguments to handle spaces. However
this
seems like a fragile solution to me.

Path with spaces are fragile.

So is there a better way to fix this? Telling users not to install into a
directory containing umlauts is not an option.

Upgrade to 1.9.2 which supports Unicode directories and filenames
properly.

On 13.02.2011 18:55, Luis L. wrote:

system() with multiple arguments is flawed in 1.8.x, but solved in
1.9.1 and 1.9.2

Rake contains alt_system functionality that allow Ruby 1.8.7 avoid
the error you’re mentioning. Perhaps you want to take a look to it
if you’re stuck with Ruby 1.8.7

Good to know.
Thank you very much for your response.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs