bbdb-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Patch for Build under MSW + MSYS2


From: Vincent Belaïche
Subject: RE: Patch for Build under MSW + MSYS2
Date: Sat, 3 Feb 2018 06:28:51 +0000

Dear Roland,

As recommended by you I resend the patch for compiling under MSW +
MSYS2 on the new list.

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.

Here is the abs_target computation:

        abs_target=`$(CYGPATH_W) '$(subst ','\"'\"',$(abs_builddir)/$@)' | sed 
's/\\([\\\"]\\)/\\\\\\1/g'`; \

The $subst Makefile construct is there in order to shell escape any ' in
the absolute path to '"'"' which is the sole way to escape them in Bash.

The sed command in the sequel is there to lisp escape any " or \ in the
absolute path to \" or \\ respectively.

I use backquotes instead of the $( ... ) bash construct for maximum
portability, as the expense of this that all " and \ have to be shell
escaped by \" and \\ respectively for backquote.

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.



Please feel free for brickbats. ;-)

  Vincent.

PS: The simpler coding is just:

        abs_target=`$(CYGPATH_W) '$(abs_builddir)/$@'`; \


De : Vincent Belaïche <address@hidden>
Envoyé : dimanche 20 août 2017 09:50
À : Roland Winkler
Objet : RE: Patch for Build under MSW + MSYS2 
 
>Dear Roland,
>OK, I will do that when time allows, there is no hurry anyway with this patch.
>Thank you for the feedback.
>  V.
>
>De : Roland Winkler <address@hidden>
>Envoyé : dimanche 20 août 2017 06:36:08
>À : Vincent Belaïche
>Objet : RE: Patch for Build under MSW + MSYS2 
> 
>On Fri Aug 18 2017 Vincent Belaïche wrote:
>> Dear Roland,
>> 
>
[...]
>
>
>I suggest you subscribe to the new mailing list address@hidden
>and resend your patch to the new list (preferably in a self-contained
>new email that does not reference your old emails that were swallowed
>by the system.)
>
>I have not yet looked at the patches you sent.

Attachment: patch-abspath.diff
Description: patch-abspath.diff


reply via email to

[Prev in Thread] Current Thread [Next in Thread]