Sv.2 suid bits (why a RESTRICTED

jim at ISM780B.UUCP jim at ISM780B.UUCP
Sat Dec 14 09:36:00 AEST 1985


>    Does anyone know why the stupid test for 'r' in the progname.
>    I thought I'd left that sort of junk behind with fortran!

The real problem is an error in the design of #!, and that error appears
to have been propagated everywhere (so at least it is consistent).
When excuting a #! file, the kernel passes (the last component of) the
file name as argv[0] to the program being run (e.g., sh).
Thus, not only does any script containing an r invoke a restricted shell
because the shell checks its argv[0] to decide whether it is to run
restricted, but also when programs which use their argv[0] to determine
how to identify themselves in error messages are run via #!, you get things
like
 
foo: syntax error in foo, line 47

instead of

<name of command>: syntax error in foo, line 47

And generally, any program which uses the name it is linked to to determine
its behavior cannot be used effectively with #!.

Whoever came up with this behavior no doubt thought at the time that it was
clever.  Such is the result of failure to think things through.

-- Jim Balter, INTERACTIVE Systems Corporation (ima!jim)



More information about the Net.bugs.usg mailing list