On 18/02/2014, at 12:17 PM, Mike Shal wrote:
> On Fri, Feb 14, 2014 at 11:45 AM, Thanassis Tsiodras <[email protected]>
> wrote:
>
> The following console output should be self explanatory - I can't seem to
> make Tup work with filenames containing spaces:
Even if you can properly parse a filename in a script,
launching a correctly formatted shell command is almost
impossible.
In particular it literally IS impossible if you want to process
the command like the shell would, with both wildcarding
and environment variable substitutions, etc.
Now in Windows all hell breaks loose, however
bash on Unix is not a whole lot better. In fact bash
is a whole lot worse because it does a lot of fancy
stuff which is effectively impossible to emulate
without actually writing a copy of bash :)
As noted in another message Windows has a limit
on command line length .. used to be 255 characters
in the old days.
For arguments, the rules are REALLY tricky. Note immediately
that using exec family functions work by concatenating the arguments
AS GIVEN to make the command line.
The bottom line here is: when you are emitting arguments to the shell,
you have to quote them. ALL OF THEM.
On Windows, when you are emitting a line to the shell, you have to quote
the line AS WELL. So for example
p a b
must be used like
shell(""p" "a" "b"");
FWIW here is the abstraction that works on Unix and Windows:
http://felix-lang.org/share/lib/std/program/shell.flx
The Posix binding:
http://felix-lang.org/share/lib/std/posix/shell.flx
And the Windows binding:
http://felix-lang.org/share/lib/std/win32/shell.flx
The bulk of the code is devoted to parsing commands lines so you can
then later emit them. Tup mightn't need that.
however, to handle filenames with "weird" characters like space in them,
you have to use quotes, and then you must follow the quoting rules
entirely, including quoting the line as well as the arguments on windows
when calling the shell.
Unfortunately if you want to support Windows or OSX, then handling spaces
in filenames correctly is mandatory.
I won't even start on the idiot case handling on both systems,
the use of UCS-2 Unicode on Solaris (and Windows) instead
of UTF-8 like Linux...
--
john skaller
[email protected]
http://felix-lang.org
--
--
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
---
You received this message because you are subscribed to the Google Groups
"tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.