Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Word splitting with zsh fix
- X-seq: zsh-workers 22260
- From: Ralf Wildenhues <Ralf.Wildenhues@xxxxxx>
- To: bug-libtool@xxxxxxx, Zsh Workers <zsh-workers@xxxxxxxxxx>
- Subject: Re: Word splitting with zsh fix
- Date: Mon, 13 Feb 2006 17:52:44 +0100
- Cc: libtool-patches@xxxxxxx
- In-reply-to: <20060212103314.GA7669@DervishD>
- Mail-followup-to: bug-libtool@xxxxxxx, Zsh Workers <zsh-workers@xxxxxxxxxx>, libtool-patches@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: Department of Numerical Simulation, University of Bonn
- References: <20060211122226.GD13513@DervishD> <20060212085653.GA28211@xxxxxxxxxxxxxxx> <20060212103314.GA7669@DervishD>
[ moving to libtool-patches; sorry for the first-post moderation ]
Hi Raúl,
* DervishD wrote on Sun, Feb 12, 2006 at 11:33:15AM CET:
> * Ralf Wildenhues <Ralf.Wildenhues@xxxxxx> dixit:
> > * DervishD wrote on Sat, Feb 11, 2006 at 01:22:26PM CET:
> > > I've spotted a problem with libtool that has to do with the word
> > > splitting that Zsh does in the expression '${1+"$@"}' (which, in
> > > turn, is a workaround to fix the "$@" expansion problem when the
> > > variable is empty in old shells). GNU autoconf has already corrected
> > > this problem, and I'm using a similar fix for libtool. The patch is
> > > gzipped and attached to this message.
> > In fact, for CVS Libtool, we just call AS_SHELL_SANITIZE to get
> > Autoconf's initialization blurb (and its fixes).
>
> Oh, good idea :))
Yes.
> > There is an open (unrelated) issue about that code being discussed
> > over at autoconf-patches at the moment; I'll backport it to
> > branch-1-5 as soon as that has settled.
>
> OK, I'll take a look as soon as it is released :)
That seems to have settled now. Also, I found that libtool needs to
employ the same workarounds for its shell wrappers, too (we should
eventually add a test for this, I guess, to expose this).
In the shell wrapper, we need the effect of _AS_BOURNE_COMPATIBLE, but
not AS_SHELL_SANITIZE: the executed program should run in the user's
locale. However, _AS_BOURNE_COMPATIBLE isn't published by Autoconf.
So I'm checking in the following patches to branch-1-5 and HEAD, and
I'll write to autoconf-patches to have a public version of the macro.
When we can rely on a released Autoconf version with the published
macro, we can simplify the shell wrapper head to something like this:
| cat >>$output <<\_LTEOF
| AS_BOURNE_COMPATIBLE
| _LTEOF
Cheers,
Ralf
HEAD:
* libltdl/config/ltmain.m4sh (func_mode_link) <shell wrapper>:
Add _AS_BOURNE_COMPATIBLE code from Autoconf, to fix issues
with zsh and other shells.
Reported by David Gómez Espinosa <david@xxxxxxxxxxxx>.
branch-1-5:
* ltmain.in <startup, shell wrapper>: Add _AS_BOURNE_COMPATIBLE
code from Autoconf, to fix issues with zsh and other shells.
Reported by David Gómez Espinosa <david@xxxxxxxxxxxx>.
* libltdl/config/ltmain.m4sh (func_mode_link) <shell wrapper>:
Add _AS_BOURNE_COMPATIBLE code from Autoconf, to fix issues
with zsh and other shells.
Reported by David Gómez Espinosa <david@xxxxxxxxxxxx>.
Index: libltdl/config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.35
diff -u -r1.35 ltmain.m4sh
--- libltdl/config/ltmain.m4sh 5 Feb 2006 11:06:31 -0000 1.35
+++ libltdl/config/ltmain.m4sh 13 Feb 2006 16:35:16 -0000
@@ -6186,6 +6186,20 @@
Xsed='${SED} -e 1s/^X//'
sed_quote_subst='$sed_quote_subst'
+# Be Bourne compatible
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ [#] Zsh 3.x and 4.x performs word splitting on \${1+\"\$[@]\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$[@]\"}'='\"\$[@]\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
* ltmain.in <startup, shell wrapper>: Add _AS_BOURNE_COMPATIBLE
code from Autoconf, to fix issues with zsh and other shells.
Reported by David Gómez Espinosa <david@xxxxxxxxxxxx>.
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltmain.in,v
retrieving revision 1.334.2.121
diff -u -r1.334.2.121 ltmain.in
--- ltmain.in 5 Feb 2006 11:08:52 -0000 1.334.2.121
+++ ltmain.in 13 Feb 2006 14:35:05 -0000
@@ -46,11 +46,19 @@
VERSION=@VERSION@
TIMESTAMP="@TIMESTAMP@"
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes.
-if test -n "${ZSH_VERSION+set}" ; then
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
# Check that we have a working $echo.
if test "X$1" = X--no-reexec; then
@@ -5271,6 +5279,20 @@
Xsed='${SED} -e 1s/^X//'
sed_quote_subst='$sed_quote_subst'
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
Messages sorted by:
Reverse Date,
Date,
Thread,
Author