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

  • Thread starter Sebastian Hungerecker
  • Start date
S

Sebastian Hungerecker

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öö\
2. Take some executable which takes an argument and copy it to
c:\föö\bla.exe
3. Add c:\föö to the PATH.

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.

I can only assume that, since system with multiple arguments does not go
through the shell, ruby tries to parse the PATH variable manually and chokes
on the umlauts.

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?

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.

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

Thanks in advance,
Sebastian
 
L

Luis Lavena

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.
 
S

Sebastian Hungerecker

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top