On 08/25/2011 01:58 PM, Claudio Bley wrote:
Hi.
I compiled diffutils for MinGW.
diff3.exe does not work with special characters in path names (like
spaces et cetera) because it does not quote special characters
correctly for the cmd shell when invoking diff.exe.
Gross. It would be better to get the mingw environment to use sh
instead of cmd, or to at least fix system() or popen() to properly munge
command lines that assumed sh quoting into something that will work when
passed to cmd, and to put that fix in mingw (or perhaps in gnulib) for
all projects to benefit from, than to hack up diffutils to support a
non-standard, poorly documented, and painful alternate quoting mechanism
just for a non-free shell.
@@ -1217,6 +1267,9 @@
p = shell_quote_copy (p, filea);
*p++ = ' ';
p = shell_quote_copy (p, fileb);
+#if defined(WIN32)&& !defined(__CYGWIN__)
+ *p++ = '"';
+#endif
*p = 0;
errno = 0;
fpipe = popen (command, "r");
Or, instead of using popen, maybe we could use gnulib's pipe-filter-gi
module, which allows us to pass the filename as a distinct argv argument
without the need for any extra quoting to be undone by an intermediate
shell.
All in all, while I appreciate your attempt to make this more robust on
mingw, I think this patch is going about a solution in the wrong way.
--
Eric Blake [email protected] +1-801-349-2682
Libvirt virtualization library http://libvirt.org