[tex-live] possible tlmgr bug
Philipp Stephani
st_philipp at yahoo.de
Wed May 4 19:45:12 CEST 2011
Am 04.05.2011 um 18:26 schrieb Maxwell, Adam R:
> Consequently, one might conclude that merely rewriting all scripts in Perl
> will not make them work as desired :).
Yes, but it is a starting point. With Perl, you have at least the possibility to get rid of all the shell quirks.
>
>> For myself I tend to avoid calling the shell whenever possible when I try to write OS-independent code. The popular "system" function in C is probably the biggest source of problems; it should be replaced by direct process creation
>
> Agreed, and I'd include popen(3) as another source of problems.
Oh yes, I forgot about that. It's in the C standard as well, and therefore popular like system(3), but not portable as well. The irony is: if you want portability, you have to avoid those standard C functions.
>
>> Then even something like `/bin/sh '$config_guess'` might work (unless the path $config_guess contains an ASCII apostrophe, of course).
>
> Still, though, Perl must have a way to pass argv directly to /bin/sh and
> capture stdout...right?
If I read perldoc perlfunc correctly, something like
open(HANDLE, "-|", "command", "arg1", "arg2", ...)
should do the job, provided that maps to the correct CreateProcessW invocation (with conversion to UTF-16 and proper quoting) on Windows and to a fork/exec or spawn_process invocation on Linux and OS X without going through any shell or standard C function.
More information about the tex-live
mailing list