NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: PR/55531 CVS commit: src/usr.bin/script



Here is another tiny patch for script(1): bin/55605. Fixes an
impairment in the program that only surfaces when stdin is not a tty.
The patch included in the PR has some ambiguous waitpid calls. While I
have already emailed an updated version to gnats-bugs@, I am also
including it here.

--- src/usr.bin/script/script.c	2020-08-24 17:27:30.907579625 -0500
+++ script.c	2020-08-27 20:47:36.399999035 -0500
@@ -204,7 +204,8 @@
 			record(fscript, ibuf, cc, 'i');
 		(void)write(master, ibuf, cc);
 	}
-	done();
+	while (1) /* Wait for SIGCHLD. */
+		sleep(1);
 	/* NOTREACHED */
 	return EXIT_SUCCESS;
 }
@@ -249,7 +250,7 @@
 		if (scc <= 0)
 			break;
 		cc = (size_t)scc;
-		(void)write(1, obuf, cc);
+		(void)write(STDOUT_FILENO, obuf, cc);
 		if (rawout)
 			record(fscript, obuf, cc, 'o');
 		else
@@ -258,7 +259,8 @@
 		if (flush)
 			(void)fflush(fscript);
 	}
-	done();
+	while (1) /* Wait for SIGCHLD. */
+		sleep(1);
 }

 static void


On 8/8/20, Soumendra Ganguly <soumendra%tamu.edu@localhost> wrote:
> Hopefully the last patch in this series of patches: bin/55551
>
> Only makes a minor modification. After a lot of testing, I was only
> able to generate errno == EBADF failure for tcgetattr "artificially",
> by using [ p close(1) ] in gdb. Therefore, errno == EBADF [ and other
> errno values for ioctl ] have all been merged into one err() call
> based on errno != ENOTTY.
>
> On 8/7/20, Soumendra Ganguly <soumendra%tamu.edu@localhost> wrote:
>> Another patch: PR bin/55548.
>>
>> This PR also makes some non-urgent requests for enhancement of the code.
>>
>> I meant I meant /src/lib/libc/gen/isatty.c in the comment.
>>
>> Thank you.
>>
>> On 8/2/20, Soumendra Ganguly <soumendra%tamu.edu@localhost> wrote:
>>> The following reply was made to PR bin/55531; it has been noted by
>>> GNATS.
>>>
>>> From: Soumendra Ganguly <soumendra%tamu.edu@localhost>
>>> To: gnats-bugs%netbsd.org@localhost
>>> Cc:
>>> Subject: Re: PR/55531 CVS commit: src/usr.bin/script
>>> Date: Sun, 2 Aug 2020 22:45:59 -0500
>>>
>>>  Perfect! You're welcome.
>>>
>>>  Soumendra
>>>
>>>  On 8/2/20, Christos Zoulas <christos%zoulas.com@localhost> wrote:
>>>  > The following reply was made to PR bin/55531; it has been noted by
>>> GNATS.
>>>  >
>>>  > From: Christos Zoulas <christos%zoulas.com@localhost>
>>>  > To: gnats-bugs%netbsd.org@localhost
>>>  > Cc: gnats-admin%netbsd.org@localhost,
>>>  >  netbsd-bugs%netbsd.org@localhost,
>>>  >  soumendra%tamu.edu@localhost
>>>  > Subject: Re: PR/55531 CVS commit: src/usr.bin/script
>>>  > Date: Sun, 2 Aug 2020 23:35:40 -0400
>>>  >
>>>  >  --Apple-Mail=_93D0E84E-E9E5-460F-A9DF-E9564C1C67D9
>>>  >  Content-Transfer-Encoding: 7bit
>>>  >  Content-Type: text/plain;
>>>  >  	charset=us-ascii
>>>  >
>>>  >
>>>  >  > Mr. Christos,
>>>  >  >          Thank you for accepting the patch and for making the
>>>  >  > additional improvements. Two more things.
>>>  >  >
>>>  >  > 1. err(EXIT_FAILURE, "fstat failed") in line #416 has an
>>> unnecessary
>>>  >  > tab character after it.
>>>  >
>>>  >  There was more than that line, I fixed them all.
>>>  >
>>>  >  > 2. Are static variables [ such as isterm ] initialized to 0 by the
>>>  >  > compiler automatically?
>>>  >
>>>  >  Yes
>>>  >
>>>  >  Thanks for the patches!
>>>  >
>>>  >  christos
>>>  >
>>>  >  --Apple-Mail=_93D0E84E-E9E5-460F-A9DF-E9564C1C67D9
>>>  >  Content-Transfer-Encoding: 7bit
>>>  >  Content-Disposition: attachment;
>>>  >  	filename=signature.asc
>>>  >  Content-Type: application/pgp-signature;
>>>  >  	name=signature.asc
>>>  >  Content-Description: Message signed with OpenPGP
>>>  >
>>>  >  -----BEGIN PGP SIGNATURE-----
>>>  >  Comment: GPGTools -
>>>  >
>>> https://urldefense.com/v3/__http://gpgtools.org__;!!KwNVnqRv!Sq1jHE4-a-Rm33zDFvKmVwtDSNIO04JAxVNwRVBhYGZFVFm8v3NnZeg_PL-fvB3v$
>>>  >
>>>  >
>>>  >  iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCXyeGDAAKCRBxESqxbLM7
>>>  >  OpOTAKCvFnyzPAmRHYQs7JgKjtn+YMpYSwCeOpdK09XAGGoNXQlUwJGzQDl/R/s=
>>>  >  =Hmmv
>>>  >  -----END PGP SIGNATURE-----
>>>  >
>>>  >  --Apple-Mail=_93D0E84E-E9E5-460F-A9DF-E9564C1C67D9--
>>>  >
>>>  >
>>>
>>>
>>
>



Home | Main Index | Thread Index | Old Index