Page MenuHomeFreeBSD

man: do not ignore the exit status of roff tools
ClosedPublic

Authored by wosch on Apr 15 2024, 1:06 PM.
Tags
None
Referenced Files
F97560671: D44798.diff
Mon, Sep 30, 2:06 AM
Unknown Object (File)
Sat, Sep 28, 6:49 PM
Unknown Object (File)
Thu, Sep 26, 8:17 AM
Unknown Object (File)
Sun, Sep 22, 7:39 PM
Unknown Object (File)
Fri, Sep 20, 10:08 PM
Unknown Object (File)
Fri, Sep 20, 12:12 PM
Unknown Object (File)
Mon, Sep 16, 5:40 PM
Unknown Object (File)
Sat, Sep 14, 9:08 AM
Subscribers

Details

Summary
Test Plan

cat /dev/null > /tmp/bla.1.gz
man /tmp/bla.1.gz >/dev/null; echo $?

gzcat: /tmp/bla.1.gz: unexpected end of file
gzcat: /tmp/bla.1.gz: unexpected end of file
grotty:<standard input>:(<standard input>):6: fatal error: 'V' command invalid before first 'p' command
1

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

wosch requested review of this revision.Apr 15 2024, 1:06 PM
wosch added reviewers: kevans, bapt, emaste, jilles.

OK. Discarding errors from $cattool is not directly related to the original issue, right?

This revision is now accepted and ready to land.Apr 15 2024, 1:15 PM

OK. Discarding errors from $cattool is not directly related to the original issue, right?

gzip may print (a useless) error message for large files if we catch SIGPIPE. E.g.

small input
(set -o pipefail; trap '' SIGPIPE; man cat | gzip |gzip -dc | head -1 >/dev/null; echo $?)
0

large input for gzcat
(set -o pipefail; trap '' SIGPIPE; man tcsh | gzip |gzip -dc | head -1 >/dev/null; echo $?)
gzcat: error writing to output: Broken pipe
gzcat: /usr/share/man/man1/tcsh.1.gz: uncompress failed
gzip: error writing to output: Broken pipe
1

You don't want to bother users with this new warnings.