in reply to The Evil Embedded Space
Until system(@list) works in Win32 [it is currently just system("@list") which is system($scalar) which isn't what is needed for portably dealing with obnoxious file names], spaces in path names will be a big problem.
This issue has little to do with "the shell", since the design of Win32 means that "the shell" has almost no responsibility for the splitting of command-line arguments (on spaces), which is the source of the problem. Each program must split its own command line and they certainly don't all go about this the same way.
But things have finally settled down such that the MS Win32 C RTL's definition of how to quote arguments is fairly widely supported. This means that system(@list) can be made to mostly work, by adding quotes around arguments that would need them if parsed by a the C RTL's command-line parser (and by escaping a few things).
Now, if one insists on using the make command, then "the shell" does become a significant source of problems and you need to invent platform-customized quoting schemes to deal with space in file names and beat people up to always use them. But that is just one problem with using make and so the best solution for this is to move away from using make in a system that tries to be portable.
Of course, "platform-customized quoting" really should be "shell-customized" but the traditional solution here is to use the one shell that is guaranteed to be on the platform in question. So, on most platforms, /bin/sh is used even for installing things for users who prefer to use zsh or whatever. Likewise, on NT+ Win32, cmd.exe is used for the same reason. Unfortunately, this same logic means that command.com is used on pre-NT Win32, but command.com is not quite up to this task. But this, again, leads me to the clear solution of relying on Perl instead of some version of 'make' and some semblance of 'sh'.
- tye
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: The Evil Embedded Space (system(@list))
by tye (Sage) on Jun 03, 2005 at 21:25 UTC |