Strange behavior of su

Mark Callow msc at saber.UUCP
Wed Sep 25 03:14:41 AEST 1985


> > Every now and then after I have been logged in for a while I will try to
> > su, have su ask the password, and then it sits for a bit and exits.  It
> 
> You didn't say to whom you were su'ing.  However, if you were becoming
> root, this behaviour doesn't make sense.  If you were becoming another
> normal user, this probably means the current directory was inaccesable
> to the new user.  In this case, su gives up quietly.  I think this is
> a case there things could be a bit more verbose.

It's not su that gives up it's the C shell.  Here's the story from the
Mt Xinu bug list as reported by Ralph Campbell.
_______________________________________________________________________________
csh--bin			      ralph (Ralph Campbell)   25 May 83  
	The C shell quits silently if the parent directory (or anything
	back to the root) isn't readable when it starts up (and if it
	isn't a login shell).  This can happen when you su to someone
	who can't read your working directory; the su fails silently.

	Here's why:  The Cshell's dinit() calls getwd() (defined in
	/usr/src/libc/libjobs/getwd.c), which notices the problem,
	writes an error message to file descriptor 2, and exits.
	However, file descriptor 2 is closed by initdesc() before
	getwd() acts.  The whole thing is a mess because you're trying
	to be compatible with version 5 on up with respect to file
	descriptors, so I daren't suggest a fix.
_______________________________________________________________________________
-- 
>From the TARDIS of Mark Callow
msc at saber.UUCP,  sun!saber!msc at decwrl.ARPA
...{decwrl,ucbvax}!sun!saber!msc, ...{amdcad,ihnp4}!saber!msc



More information about the Comp.unix.wizards mailing list