Broken pipe error

Matthew Dillon dillon at apollo.backplane.com
Fri Jul 14 11:22:42 PDT 2006


:Petr Janda wrote:
:> Ok, it seems that I found a bug.
:> 
:> elevator# man ppp
:> zcat: error writing to output: Broken pipe
:> zcat: /usr/share/man/cat8/ppp.8.gz: uncompress failed
:
:Do you get that for all man pages or just ppp(8)?
:
:Sascha
:
:-- 
:http://yoyodyne.ath.cx

    The error is quite simply due to the fact that the pager program
    (more) exited without reading all the input from the pipe.  It
    only occurs sometimes because it depends on whether the pipe
    direct-maps zcat's (gunzip's) write to the pager program's read.

    But, of course, the pager program exited because the user quit out
    of it before it read all the input from zcat.

    I think the solution is to modify the 'man' program to pass the '-q'
    option to zcat (gunzip), and to modify gunzip to do a
    signal(SIGPIPE, SIG_IGN) when used with the -q option.

    Petr, please try rebuilding the 'man' program and the gzip program 
    using this patch.  Please tell me if it stops the errors.  Here is 
    the build sequence after applying the patch:

	cd /usr/src/gnu/usr.bin/man
	make clean obj all install
	cd /usr/src/usr.bin/gzip
	make clean obj all install

    Patch is included below.

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>

Index: gnu/usr.bin/man/Makefile.inc
===================================================================
RCS file: /cvs/src/gnu/usr.bin/man/Makefile.inc,v
retrieving revision 1.2
diff -u -r1.2 Makefile.inc
--- gnu/usr.bin/man/Makefile.inc	17 Jun 2003 04:25:46 -0000	1.2
+++ gnu/usr.bin/man/Makefile.inc	14 Jul 2006 18:14:49 -0000
@@ -22,7 +22,7 @@
 refer=			/usr/bin/refer
 grap=			# no grap
 pic=			/usr/bin/pic
-zcat=			/usr/bin/zcat
+zcat=			/usr/bin/zcat -q
 compress=		/usr/bin/gzip -c
 compext=		.gz
 
Index: usr.bin/gzip/gzip.c
===================================================================
RCS file: /cvs/src/usr.bin/gzip/gzip.c,v
retrieving revision 1.5
diff -u -r1.5 gzip.c
--- usr.bin/gzip/gzip.c	31 Jan 2005 19:28:57 -0000	1.5
+++ usr.bin/gzip/gzip.c	14 Jul 2006 18:17:11 -0000
@@ -314,6 +314,7 @@
 			break;
 		case 'q':
 			qflag = 1;
+			signal(SIGPIPE, SIG_IGN);
 			break;
 		case 'r':
 			rflag = 1;





More information about the Bugs mailing list