autoconf-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] Ditch _AS_LINENO_PREPARE from _AS_PREPARE


From: Eric Blake
Subject: Re: [PATCH] Ditch _AS_LINENO_PREPARE from _AS_PREPARE
Date: Thu, 30 Oct 2008 17:36:02 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Blake <ebb9 <at> byu.net> writes:

>  cat <<EOF
> -3. $LINENO
> -4. $LINENO
> +5. $LINENO
> +6. $LINENO
> +7. \$LINENO
>  EOF

>  $ @kbd{sed '=' <lineno |}
> @@ -14493,16 +14534,28 @@ Special Shell Variables
>  > @kbd{  ' |}
>  > @kbd{  sh}
...
> +7. \7

Ouch.  Our sed preprocess has the possibility of generating non-portable child 
scripts.  Anywhere where the parent script uses:

cat >>child <<EOF
AS_ESCAPE([text], [$`])
EOF

then any instances of $LINENO in text will be turned into \$LINENO.  But since 
the sed preprocess currently munges that instance, the \ is no longer quoting a 
special character, so we have inserted a raw \ into the child script.  In turn, 
as demonstrated by the above simple example, we could be causing other 
portability nightmares such as calling the non-portable 'echo "\7"' instead of 
the intended 'echo "$LINENO"' in a shell with LINENO support.

But is it even possible to write the sed script more robustly, as we really 
don't know the difference between here-doc contents and other instances of 
\$LINENO?

-- 
Eric Blake







reply via email to

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