[10222] in Athena Bugs

home help back first fref pref prev next nref lref last post

rsaix 7.4G: script: 2 bugs + fix

daemon@ATHENA.MIT.EDU (Calvin Clark)
Tue Jan 26 00:04:16 1993

Date: Tue, 26 Jan 93 00:04:12 -0500
From: Calvin Clark <ckclark@mit.edu>
To: bugs@Athena.MIT.EDU
Reply-To: ckclark@mit.edu

System name:		augmented
Type and version:	POWER 7.4G
Display type:		graygda

(Please note that this happens on *all* Athena platforms, not just the
RS/6000.)

What were you trying to do?

	Use `script' to get a log of what I'm doing.

What's wrong:

	Script will not find $SHELL unless SHELL is an explicit path
name.  For example, if $SHELL is `sh', it will lose with the error:

	Script started, file is typescript
	sh: No such file or directory
	Script done, file is typescript

but if $SHELL is /bin/sh, it will work.  This is because it is being
braindead and using execl() instead of execlp().

What should have happened:
	

	It should work.  Script is not setuid, and it need not be so
restrictive.

Here's a fix for the BSD version.  Note that this fix also changes the
second argument to execlp(), as it is inappropriate to always use "sh"
for argv[0] in the new process.  If you want to be anal about it, you
could strip the leading components of the pathname, but it is
stylistically acceptable to use the full path (see execl(3)).  It is
*not*, however, stylistically acceptable to try to spoof "ps."  :-)
This is the second bug.

*** /source/bsd-4.3/common/ucb/script.c	Fri Mar 30 09:54:03 1990
--- script.c	Mon Jan 25 23:51:26 1993
***************
*** 161,167 ****
  	(void) dup2(slave, 1);
  	(void) dup2(slave, 2);
  	(void) close(slave);
! 	execl(shell, "sh", "-i", 0);
  	perror(shell);
  	fail();
  }
--- 161,167 ----
  	(void) dup2(slave, 1);
  	(void) dup2(slave, 2);
  	(void) close(slave);
! 	execlp(shell, shell, "-i", 0);
  	perror(shell);
  	fail();
  }

Please describe any relevant documentation references:

	execl(3), script(1)

home help back first fref pref prev next nref lref last post