zsh-workers
 help / color / mirror / code / Atom feed
From: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
To: bug-libtool@gnu.org, Zsh Workers <zsh-workers@sunsite.dk>
Cc: libtool-patches@gnu.org
Subject: Re: Word splitting with zsh fix
Date: Mon, 13 Feb 2006 17:52:44 +0100	[thread overview]
Message-ID: <20060213165244.GB18647@iam.uni-bonn.de> (raw)
In-Reply-To: <20060212103314.GA7669@DervishD>

[-- Attachment #1: Type: text/plain, Size: 2221 bytes --]

[ 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@gmx.de> 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@pleyades.net>.

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@pleyades.net>.

[-- Attachment #2: HEAD-bourne-compatible-wrapper.diff --]
[-- Type: text/plain, Size: 1252 bytes --]

	* 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@pleyades.net>.

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

[-- Attachment #3: branch-1-5-bourne-compatible.diff --]
[-- Type: text/plain, Size: 2017 bytes --]

	* 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@pleyades.net>.

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

  reply	other threads:[~2006-02-13 16:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-11 12:22 DervishD
2006-02-12  8:56 ` Ralf Wildenhues
2006-02-12 10:33   ` DervishD
2006-02-13 16:52     ` Ralf Wildenhues [this message]
2006-02-12 15:05 ` Roumen Petrov
2006-02-12 16:57   ` Andrey Borzenkov
2006-02-12 21:52     ` Roumen Petrov
2006-02-12 18:45   ` Wayne Davison
2006-02-12 21:52     ` Roumen Petrov
2006-02-13  8:46       ` Wayne Davison
2006-02-13 11:37   ` DervishD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060213165244.GB18647@iam.uni-bonn.de \
    --to=ralf.wildenhues@gmx.de \
    --cc=bug-libtool@gnu.org \
    --cc=libtool-patches@gnu.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).