ned@SCIRTP.UUCP (Ned Robie) (07/27/85)
We run IN/ix, Interactive Systems' port of System III. When a program exec()s /bin/sh with argument 0 set to -sh, .profile is being read from ./.profile instead of $HOME/.profile as documented in every Unix user's manual that I've looked at. Is this a documentation problem or a bug? Do other Unix systems have the same problem? What is the correct behavior? Thanks... -- Ned Robie
guy@sun.uucp (Guy Harris) (07/28/85)
> We run IN/ix, Interactive Systems' port of System III. When a program > exec()s /bin/sh with argument 0 set to -sh, .profile is being read from > ./.profile instead of $HOME/.profile as documented in every Unix user's > manual that I've looked at. Is this a documentation problem or a bug? It's a documentation problem. "sh" is supposed to read .profile from the current directory. This doesn't cause a problem, because you aren't supposed to run login shells (i.e., shells with argv[0] equal to "-sh") unless you're in the user's home directory. > Do other Unix systems have the same problem? What is the correct behavior? All other UNIX systems behave the same way. Guy Harris
john@basser.oz (John Mackin) (08/03/85)
In article <2510@sun.uucp> guy@sun.uucp (Guy Harris) writes: > It's a documentation problem. "sh" is supposed to read .profile from the > current directory. This doesn't cause a problem, because you aren't > supposed to run login shells (i.e., shells with argv[0] equal to "-sh") > unless you're in the user's home directory. > > > Do other Unix systems have the same problem? What is the correct behavior? > > All other UNIX systems behave the same way. When is a bug a bug? My feeling has long been that the manual entry was always right. After all, that was the statement, by the author of the code concerned, of said code's expected behavior; and it seems to me VERY unlikely that Steve Bourne didn't know what he really meant when he wrote ``If the first character of argument zero is -, commands are first read from $HOME/.profile, if such a file exists.''. Whereas every programmer knows how easy it can be to write code that doesn't really mean what you thought it did. How do you know what sh is ``supposed'' to do, Guy? Did you ask Bourne? It seems to me that code is supposed to do what its manual entry says. And as far as users being not ``supposed'' to run -sh except in their home directory, I think there is rather too much supposing going on. A common idiom on our systems, where /bin/-sh is a link to /bin/sh, is "exec -sh" to replace the current shell with a new login shell (for testing a modification to .profile, for instance). It would hardly be reasonable to require the user to be in his/her home directory when doing such or not have their .profile executed. (Our sh was fixed long ago to conform to the manual entry; so not ALL other UNIX systems behave the same way.)