From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19593 invoked from network); 13 Feb 2006 16:52:57 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 13 Feb 2006 16:52:57 -0000 Received: (qmail 56824 invoked from network); 13 Feb 2006 16:52:50 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 13 Feb 2006 16:52:50 -0000 Received: (qmail 4482 invoked by alias); 13 Feb 2006 16:52:48 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 22260 Received: (qmail 4471 invoked from network); 13 Feb 2006 16:52:47 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 13 Feb 2006 16:52:47 -0000 Received: (qmail 56540 invoked from network); 13 Feb 2006 16:52:47 -0000 Received: from nic.iam.uni-bonn.de (HELO iam.uni-bonn.de) (131.220.223.1) by a.mx.sunsite.dk with SMTP; 13 Feb 2006 16:52:47 -0000 Received: (qmail 20087 invoked from network); 13 Feb 2006 16:52:45 -0000 Received: from gibil.iam.uni-bonn.de (HELO iam.uni-bonn.de) (131.220.223.9) by hermes.iam.uni-bonn.de with (EDH-RSA-DES-CBC3-SHA encrypted) SMTP; 13 Feb 2006 16:52:45 -0000 Date: Mon, 13 Feb 2006 17:52:44 +0100 From: Ralf Wildenhues To: bug-libtool@gnu.org, Zsh Workers Cc: libtool-patches@gnu.org Subject: Re: Word splitting with zsh fix Message-ID: <20060213165244.GB18647@iam.uni-bonn.de> Mail-Followup-To: bug-libtool@gnu.org, Zsh Workers , libtool-patches@gnu.org References: <20060211122226.GD13513@DervishD> <20060212085653.GA28211@iam.uni-bonn.de> <20060212103314.GA7669@DervishD> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="vKFfOv5t3oGVpiF+" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20060212103314.GA7669@DervishD> Organization: Department of Numerical Simulation, University of Bonn User-Agent: Mutt/1.5.11 --vKFfOv5t3oGVpiF+ Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit [ 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 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) : Add _AS_BOURNE_COMPATIBLE code from Autoconf, to fix issues with zsh and other shells. Reported by David Gómez Espinosa . branch-1-5: * ltmain.in : Add _AS_BOURNE_COMPATIBLE code from Autoconf, to fix issues with zsh and other shells. Reported by David Gómez Espinosa . --vKFfOv5t3oGVpiF+ Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename="HEAD-bourne-compatible-wrapper.diff" Content-Transfer-Encoding: 8bit * libltdl/config/ltmain.m4sh (func_mode_link) : Add _AS_BOURNE_COMPATIBLE code from Autoconf, to fix issues with zsh and other shells. Reported by David Gómez Espinosa . 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 --vKFfOv5t3oGVpiF+ Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename="branch-1-5-bourne-compatible.diff" Content-Transfer-Encoding: 8bit * ltmain.in : Add _AS_BOURNE_COMPATIBLE code from Autoconf, to fix issues with zsh and other shells. Reported by David Gómez Espinosa . 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 --vKFfOv5t3oGVpiF+--