zsh-workers
 help / color / mirror / code / Atom feed
* incorrect behavior of zsh under su on SUNOS-4.1.3
@ 1997-06-09  8:40 Juergen Peter bluen
  1997-06-09 16:09 ` Zefram
  1997-06-10  5:59 ` Andrej Borsenkow
  0 siblings, 2 replies; 3+ messages in thread
From: Juergen Peter bluen @ 1997-06-09  8:40 UTC (permalink / raw)
  To: zsh-workers

Hello Folks,

Some problems have been encountered here when using ZSH-3.1.2 on a 
SunOS-4.1.3 system.

It looks very much like that if invoked from other programs in a way
like

	exec("/path/to/zsh", argv[0], other_args)

what many programs do to spawn a shell or a subshell,
zsh_name (the variable in the sourcecode) is set to argv[0] of the
spawning program.

This looks quite ok for me (at least for most programs), but when the
shell-spawning program is /bin/su (or /usr/5bin/su) of SunOS, this
prevents the shell from reading its initialisation files (/etc/zshenv
and so on), which isn´t correct behaviour according to the
documentation of su(1). Other programs calling exec*(2) in a similar
way lead to the same problem (I checked elm-2.4 for example).

Maybe some of you folks would like to address the problem and solve it 
like this:

	if zsh_name is set to something different than zsh (or -zsh),
	always set it to "zsh", so that init files are read for every
	subshell in the ususal way. Maybe this is best done by adding
	something like (below line # 53 in main.c)

if (strcmp(zsh_name,"zsh") != 0 && strcmp(zsh_name, "-zsh") !=0 )
	zsh_name="zsh"; 

	or even by replacing line 53 in main.c with
	zsh_name = "zsh";

Of course, there might be trouble somewhere else when solving the
problem like this (like we do here at our installation), so that there 
may be better solutions (I´m not a shell-hacker).

If you have suggestions for better solutions of my problem or want
additional information, please email me directly because I´m not
subscribed to zsh-workers, zsh-users (I don´t even remember being
subscribed to zsh-announce).

bluen
-- 
Juergen Peter                     | PGP encrypted mail is welcome.
Lehrstuhl fuer Mikroelektronik    | See my homepage for disclaimer!
Univ. Geb. 13, Postfach 151150,   | email: bluen@ee.uni-sb.de
66041 Saarbruecken                | http://www.ee.uni-sb.de/~bluen/ 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: incorrect behavior of zsh under su on SUNOS-4.1.3
  1997-06-09  8:40 incorrect behavior of zsh under su on SUNOS-4.1.3 Juergen Peter bluen
@ 1997-06-09 16:09 ` Zefram
  1997-06-10  5:59 ` Andrej Borsenkow
  1 sibling, 0 replies; 3+ messages in thread
From: Zefram @ 1997-06-09 16:09 UTC (permalink / raw)
  To: bluen; +Cc: zsh-workers

Juergen Peter "bluen wrote:
>what many programs do to spawn a shell or a subshell,
>zsh_name (the variable in the sourcecode) is set to argv[0] of the
>spawning program.

zsh_name is set to zsh's argv[0], which is whatever the execing program
wants it to be.

>This looks quite ok for me (at least for most programs), but when the
>shell-spawning program is /bin/su (or /usr/5bin/su) of SunOS, this
>prevents the shell from reading its initialisation files (/etc/zshenv
>and so on),

Opinion: this behaviour of su is broken.  It should set argv[0]
conventionally -- the shell has no need to know it is being run by su.

>	if zsh_name is set to something different than zsh (or -zsh),
>	always set it to "zsh", so that init files are read for every
>	subshell in the ususal way.

No, there's a reason why zsh_name gets set to argv[0].  zsh will emulate
ksh or POSIX sh if argv[0] (and therefore zsh_name) are set to "ksh" or
"sh".  If zsh_name were always "zsh", there wouldn't be any point in it
being a variable.

-zefram


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: incorrect behavior of zsh under su on SUNOS-4.1.3
  1997-06-09  8:40 incorrect behavior of zsh under su on SUNOS-4.1.3 Juergen Peter bluen
  1997-06-09 16:09 ` Zefram
@ 1997-06-10  5:59 ` Andrej Borsenkow
  1 sibling, 0 replies; 3+ messages in thread
From: Andrej Borsenkow @ 1997-06-10  5:59 UTC (permalink / raw)
  To: Juergen Peter bluen; +Cc: zsh-workers

On Mon, 9 Jun 1997, Juergen Peter bluen wrote:

> Hello Folks,
> 
> Some problems have been encountered here when using ZSH-3.1.2 on a 
> SunOS-4.1.3 system.
> 
> It looks very much like that if invoked from other programs in a way
> like
> 
> 	exec("/path/to/zsh", argv[0], other_args)
> 
> what many programs do to spawn a shell or a subshell,
> zsh_name (the variable in the sourcecode) is set to argv[0] of the
> spawning program.
> 
> This looks quite ok for me (at least for most programs), but when the
> shell-spawning program is /bin/su (or /usr/5bin/su) of SunOS, this
> prevents the shell from reading its initialisation files (/etc/zshenv
> and so on), which isn´t correct behaviour according to the
> documentation of su(1). Other programs calling exec*(2) in a similar
> way lead to the same problem (I checked elm-2.4 for example).
> 

I just tried it with my /bin/su, and I don't quite understand, what do you
mean. If called as 'su user' zsh is called with
  
  execve ("/usr/bin/zsh", "zsh", ...)

and if called as 'su - user' zsh is called with
  
  execve ("/usr/bin/zsh", "-zsh", ...)

The problem in the first case is, that environment is not changed, that
is, HOME still points to original user's home, and zsh tries to source
startup files from wrong directory. If they don't exist (e.g., on my
system root doesn't have ~/.z* files at all), it appears, as if startup
files weren't sourced.

could you provide example of exact exec's in your case?

greetings

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-06-10  6:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-06-09  8:40 incorrect behavior of zsh under su on SUNOS-4.1.3 Juergen Peter bluen
1997-06-09 16:09 ` Zefram
1997-06-10  5:59 ` Andrej Borsenkow

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).