From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19562 invoked from network); 16 Jun 1997 04:36:51 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 16 Jun 1997 04:36:51 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id AAA09258; Mon, 16 Jun 1997 00:25:53 -0400 (EDT) Resent-Date: Mon, 16 Jun 1997 00:25:53 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199706160429.AAA03740@hzoli.home> Subject: Re: zsh does not execute skripts on AIX? In-Reply-To: <9706101118.AA31816@tchibm3.chemie.uni-karlsruhe.de> from Marco Kattannek at "Jun 10, 97 01:24:46 pm" To: marcok@tchibm3.chemie.uni-karlsruhe.de (Marco Kattannek) Date: Mon, 16 Jun 1997 00:29:25 -0400 (EDT) Cc: zsh-workers@math.gatech.edu (Zsh hacking and development) X-Mailer: ELM [version 2.4ME+ PL31 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"VSkNX2.0.bG2.H1Cfp"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3246 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu > > > I have encountered a strange behavour of the zsh on AIX 3.2 . > > > The zsh (2.5 and 3.1) does not execute scripts that are passed to the > > > /bin/sh . The sh drops the error message: > > > : 0402-026 The specified data is not a valid identifier. > > > > Looks like there is some junk in the environment which confuses /bin/sh. > > I've never had such problems on AIX. Probably the program which calls zsh > > put something into the environment which sh cannot handle. Zsh just passes > > this down to sh while ksh probably filters this out. The patch below should take care of this problem. It only adds those variables to the new environment which are accessable via zsh parameters. If an environment variable is multiply defined, only the second definition is kept and the there will be only a single definition in the new environment (this is consistent with ksh). Zoltan *** Src/params.c 1997/06/05 04:44:57 3.1.3.0 --- Src/params.c 1997/06/16 04:16:25 *************** *** 98,110 **** old_environ = environ; num_env = arrlen(old_environ); environ = (char **) zalloc(sizeof(char *) * (num_env + 1)); ! for (envp = environ, envp2 = old_environ; *envp2; envp2++) ! *envp++ = ztrdup(*envp2); ! *envp = NULL; /* Now incorporate environment variables we are inheriting * * into the parameter hash table. */ ! for (envp = environ, envp2 = old_environ; *envp2; envp++, envp2++) { for (str = *envp2; *str && *str != '='; str++); if (*str == '=') { iname = NULL; --- 98,108 ---- old_environ = environ; num_env = arrlen(old_environ); environ = (char **) zalloc(sizeof(char *) * (num_env + 1)); ! *environ = NULL; /* Now incorporate environment variables we are inheriting * * into the parameter hash table. */ ! for (envp = environ, envp2 = old_environ; *envp2; envp2++) { for (str = *envp2; *str && *str != '='; str++); if (*str == '=') { iname = NULL; *************** *** 113,125 **** iname = *envp2; if ((!(pm = (Param) paramtab->getnode(paramtab, iname)) || !(pm->flags & PM_DONTIMPORT)) && ! (pm = setsparam(iname, metafy(str + 1, -1, META_DUP)))) { pm->flags |= PM_EXPORTED; ! pm->env = *envp; if (pm->flags & PM_SPECIAL) ! pm->env = replenv(pm->env, getsparam(iname)); ! } else if (pm) ! for (t = envp--; (t[0] = t[1]); t++); } *str = '='; } --- 111,125 ---- iname = *envp2; if ((!(pm = (Param) paramtab->getnode(paramtab, iname)) || !(pm->flags & PM_DONTIMPORT)) && ! (pm = setsparam(iname, metafy(str + 1, -1, META_DUP))) && ! !(pm->flags & PM_EXPORTED)) { ! *str = '='; pm->flags |= PM_EXPORTED; ! pm->env = *envp++ = ztrdup(*envp2); ! *envp = NULL; if (pm->flags & PM_SPECIAL) ! pm->env = replenv(pm->env, getsparam(pm->nam)); ! } } *str = '='; }