🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Calvin Clark Tue, 26 Jan 1993 06:02
script(1) requires absolute path, hardcodes argv[0] to "sh"
#399
Author: Calvin Clark
Date: Tue, 26 Jan 1993 06:02
56 lines
1871 bytes
Description:
	
	If the SHELL environment variable isn't an explicit path,
script(1) won't find it.  Also, it sets argv[0] in the new shell to
`sh', regardless of the name of the shell.

	It's not a setuid program and it doesn't have to be so
restrictive.

Repeat-by:

	First problem:

	$ SHELL=sh; export SHELL
	$ script
	Script started, file is typescript
	sh: No such file or directory
	Script done, file is typescript
	$

	Second problem:

	$ ln -s /bin/sh /tmp/foo
	$ SHELL=/tmp/foo; export SHELL
	$ script
	Script started, file is typescript
	$ echo $0
	sh

Fix:

*** script.c.old	Tue Jan 26 00:14:02 1993
--- script.c	Tue Jan 26 00:20:05 1993
***************
*** 194,200 ****
  	(void) dup2(slave, 1);
  	(void) dup2(slave, 2);
  	(void) close(slave);
! 	execl(shell, "sh", "-i", 0);
  	perror(shell);
  	fail();
  }
--- 194,200 ----
  	(void) dup2(slave, 1);
  	(void) dup2(slave, 2);
  	(void) close(slave);
! 	execlp(shell, shell, "-i", 0);
  	perror(shell);
  	fail();
  }

--
Calvin Clark <ckclark@mit.edu>                                    : MIT
For the network challenged: / uunet!mit-eddie!mit-athena!ckclark  : Academic 
                            \ ckclark%mit.edu@MITVMA.bitnet       : Computing
For the hopeless bureaucrat:  Calvin_Clark@MIT.EDU                : Services
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads