Hi Karl! I saw Bruno's email and patch.
I was going to just say that this patch is good and go ahead with it, but I decided to check it and turns out it fixes this issue only partially, but the patch itself is good. Msys2 has multiple environments (see https://www.msys2.org/docs/environments/) and this patch works only for `MSYS`. For all other environments `uname` will report a string starting with `MINGW64` and `compile` will set `file_conv` variable to `mingw`. This, unfortunately, overlaps with mingw32 which does not have `cygpath`. For `mingw` the filename is converted in `compile` as follows: ``` mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ``` The resulting converted filename has forward slashes as with `cygpath -m` and suffers from the same double conversion issue. In theory we could prepend `cygpath` invocation in this branch like this: ``` mingw/*) file=`cygpath -w "$file" 2>/dev/null || cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ``` However, compilation is still going to fail if there is no `cygpath` (also ,`cygpath` is not installed with Msys2 by default). I think a better solution may be to add additional sed invocation in the pipe to convert forward slashes to backslashes. I also was wondering if passing `mingw` as the second argument into `func_file_conv ` in this branch could help, but unfortunately `/filename` in resulting `-Tp/filename` is not converted by Msys2. ``` *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" ``` I hope I didn't cause too much confusion about `MSYS2_ARG_CONV_EXCL`, I was a bit in a hurry and probably didn't make it clear that I meant setting `MSYS2_ARG_CONV_EXCL` more like an external user-side workaround (e.g. I was setting it in my build script). - Kirill Makurin ________________________________ From: Karl Berry <k...@freefriends.org> Sent: Monday, February 3, 2025 7:35 AM To: bug-gnulib@gnu.org <bug-gnulib@gnu.org> Cc: maiddais...@outlook.com <maiddais...@outlook.com> Subject: setting $MSYS2_ARG_CONV_EXCL in compile script? [Hi Kirill - this is the msg I sent to bug-gnulib that Bruno responded to. I forgot that Microsoft has blacklisted my mail server, so have to send to you via another route. Can you check if Bruno's patch works for you, please? --karl] Kirill (cc'd) proposed setting the MSYS2_ARG_CONV_EXCL envvar in the compile script which comes from Automake, to avoid a double-conversion. See his report in the first msg here, and the final suggestion in the last: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=75939 I don't know anything about this. I've never done any programming under Windows, or msys, cygwin, wine, or any other Unix emulator under Windows. So I wanted to ask for advice before tinkering with something as basic as the compile script in this way. Especially since it currently does not set any environment variables. So ... I'm hoping for feedback like "yeah sure", or "no, we should do xyz instead", or "the problem is actually abc", or something. Since no feedback was forthcoming on the automake list, I'm trying here. And if we do apply it, then where? In this branch? cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` But I fear this will cause trouble on cygwin. But if we separate the branches, then it seems like other trouble could ensue. Setting it unconditionally in all cases seems unnecessarily global to me, though maybe that is the simplest. Please advise? --thanks, karl.