autoconf-patches
[Top][All Lists]
Advanced

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

Re: Avoid unportable nested double-quotes and backquotes.


From: Bruno Haible
Subject: Re: Avoid unportable nested double-quotes and backquotes.
Date: Wed, 23 Jun 2010 02:43:12 +0200
User-agent: KMail/1.9.9

Hi Ralf,

> With the very expressions you are using, you are getting lucky to not
> hit the bug.  If you just add a space before $ac_dir, then all of a
> sudden Solaris sh and ksh and other old shells fall apart quickly:
> 
> $ ac_dir=./foo
> $ ac_dir_suffix="/`echo " $ac_dir"|sed 's%^\./%%'`"
> ksh: : cannot execute
> ksh: ./foo|sed 's%^\./%%': cannot execute

Oh, indeed! I reproduce with /bin/sh and /bin/ksh on Solaris 10, as well as
with ksh (ksh-93s) on Linux. I don't reproduce with zsh, dash, and
pdksh 5.2.14 (= /bin/sh on OpenBSD 4.5) (without and with 'set -o posix').

> please do code reviewers
> a favor by not making them stumble over such an almost-bug

Agreed. Thanks for your insight! I wasn't aware that the bug was only a
space away. It's definitely worth documenting in the Automake manual.

>  Worse yet, not all shells understand 
> @code{"address@hidden"@dots{}\"@dots{}`"}
> -the same way.  There is just no portable way to use double-quoted
> +the same way (@pxref{pdksh}).

Here I would refer to both 'ksh' and 'pdksh', because 'ksh' has a bigger
problem than 'pdksh'.

Bruno



reply via email to

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