|
From: | Vincent Belaïche |
Subject: | RE: Patch for Build under MSW + MSYS2 |
Date: | Thu, 8 Feb 2018 20:04:03 +0000 |
Dear Roland,
The CYGPATH_W variable is provided by autotools whathever the platform,
but on all *nixy system that just does an echo. On MSWindows it converts the abolute path from the MSYS/Cygwin mount to
the real MSWindows file system, for instance /usr/local/bin can be converted to C:\Programmes\msys64\usr\local\bin --- well actually you cannot guess without calling the cygpath command, it depends how Cygwin/Msys2 was installed. Concerning the second comment I can send another patch with the
simplified as much as possible way: abs_target=`$(CYGPATH_W) $(abs_builddir)/$@ | sed 's/\\([\\]\\)/\\\\\\1/g'`; \ Please note that it cannot be simplified further : I still need the pipe to sed command because cygwin -w use the \ filename separator, so that needs to be elisp-string escaped. I would be more than happy if you accept this version, as my sole and
primary objective was to make it work ALSO on MSWindows using the scheme provided and tested by autotools. My thinking about poviding the other version was basically that, in
relative terms, there is not so much complexity between the simplified version and the one that does it all. It was also funny to explore this. Vincent.
De : Roland Winkler <address@hidden>
Envoyé : lundi 5 février 2018 01:22:59 À : Vincent Belaïche Cc : address@hidden Objet : RE: Patch for Build under MSW + MSYS2 On Sat Feb 3 2018 Vincent Belaïche wrote:
> The patch computes the absolute path in a shell variable named > abs_target in order to use maybe the cygpath -w command and get the real > path. Automake CYGPATH_W expands to cygpath -w on MSWindows, and to echo > otherwise. What is the reason to call cygpath? What problem does this solve? I know little to nothing about cygwin. > The patch could be simpler if you consider that there aren't going to be > any directory name in the absolute path containing a single quote, a > double quote or a backslash (cygpath outputs forward slashes as filename > separator). Although single quotes, double quotes and backslash are > allowed filename characters under *nixy shells, autotools check for that > and prevent building with such a dir name within root directory. So all > the complication for handling ' " and \ is just overkill in this > case. However, the reason why I opted out to writing it this way, is > that I think that it is good to have some reference code for handling > absolute paths in any cases of bash ports, so this code could be reused > in another context than autotools as a reference bulletproof coding. I am not sure bbdb should take a lead here to provide solutions to such rather exotic problems. I am tempted to say: if someone really wants to put quotes into filenames be prepared for trouble. I see little point in trying to be smarter than autotools. If you want to provide a reference showing that such things *can* be done, it seems to me there must be better, more prominent places than bbdb. Roland |
[Prev in Thread] | Current Thread | [Next in Thread] |