Re: quotearg.c's shell_quoting_style and MinGW

Paul Eggert <[email protected]>
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.comp.gnu.utils.bugs
Organization UCLA Computer Science Department
Message-ID <[email protected]>
On 05/05/2012 09:54 AM, Eli Zaretskii wrote:
> When quoting a shell command argument (using shell_quoting_style or
> shell_always_quoting_style), quotearg.c uses the '..' style of
> quoting.  This doesn't work for MinGW, which supports only the ".."
> style.  This causes, e.g., diff3 to fail for file names with embedded
> whitespace or other special characters, when compiled for MinGW.

Unfortunately quotearg is used not just to quote
strings for the shell, but also to quote strings POSIX-shell-style
for stdout.  That is, in practice shell_quoting_style doesn't mean
"quote this safely for whatever shell the current system happens to
be using", it means "quote this safely for POSIX shell syntax".

I suggest instead  putting a wrapper around popen and system,
so that they translate quotes from the POSIX syntax to the
syntax expected by mingw.  That would fix the problem with diff,
and it would be a more-useful fix anyway, as it would catch
instances of this problem that can occur even when quotearg is
not used.  This wrapper would be at the gnulib level.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.