Bug 152132 - script(1): [patch] Useless code in script.c (part 2)
Summary: script(1): [patch] Useless code in script.c (part 2)
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 7.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2010-11-11 06:20 UTC by Ronald F. Guilmette
Modified: 2018-01-03 05:16 UTC (History)
0 users

See Also:

file.diff (1.21 KB, patch)
2010-11-11 06:20 UTC, Ronald F. Guilmette
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ronald F. Guilmette 2010-11-11 06:20:09 UTC
	There appears to be a bunch of utterly useless (and perhaps even
	time wasting) code in script.c, and specifically within the
	finish() function.

	In that function there is a loop that reaps all child processes that
	are immediately available for reaping.  But this must be a leftover
	from an earlier time when script.c was implemented with -two- child
	processes.  Nowadays, it uses only one child process, i.e. the
	child shell process.  So it makes no sense to loop while trying to
	reap multiple child processes, because there is at most only one,
	the child shell process (and so it isn't even necessary or useful
	to call wait3() because a simple call to wait() should do.)

	Furthermore, if the idea is to reap the one and only child process,
	then before the reaping attempt even begins something positive
	should be done to cause the child to understand that it should exit
	now, i.e. calling close() on the "master" pty fd, i.e. just prior to
	all places in the code where the finish() function (or the done()
	function) is about to be called.  That should cause the child (shell)
	process to receive EOF on stdin/stdout/stderr, and that will probably
	cause it to figure out that it is time to go bye bye (if it hasn't
	done so already).

How-To-Repeat: 	Look at the code.
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:05 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped