zsh-workers
 help / color / mirror / code / Atom feed
From: Zoltan Hidvegi <hzoli@ny.frontiercomm.net>
To: marcok@tchibm3.chemie.uni-karlsruhe.de (Marco Kattannek)
Cc: zsh-workers@math.gatech.edu (Zsh hacking and development)
Subject: Re: zsh does not execute skripts on AIX?
Date: Mon, 16 Jun 1997 00:29:25 -0400 (EDT)	[thread overview]
Message-ID: <199706160429.AAA03740@hzoli.home> (raw)
In-Reply-To: <9706101118.AA31816@tchibm3.chemie.uni-karlsruhe.de> from Marco Kattannek at "Jun 10, 97 01:24:46 pm"

> > > 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 = '=';
  	    }


      parent reply	other threads:[~1997-06-16  4:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-09 11:41 Marco Kattannek
1997-06-09 17:32 ` Zoltan T. Hidvegi
1997-06-10 11:24   ` Marco Kattannek
1997-06-13 15:54     ` Bill Pemberton
1997-06-13 16:55       ` Marco Kattannek
1997-06-16  4:29     ` Zoltan Hidvegi [this message]

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=199706160429.AAA03740@hzoli.home \
    --to=hzoli@ny.frontiercomm.net \
    --cc=marcok@tchibm3.chemie.uni-karlsruhe.de \
    --cc=zsh-workers@math.gatech.edu \
    /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).