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