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        


In reply to Re: The Evil Embedded Space (system(@list)) by tye
in thread The Evil Embedded Space by Intrepid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.