delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/07/20/08:54:51

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <42DE4975.4090409@byu.net>
Date: Wed, 20 Jul 2005 06:54:13 -0600
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: man - broken pipe [Attn: man maintainer]
References: <dbkuat$2h1$1 AT sea DOT gmane DOT org> <42DE0998 DOT DB8F6E09 AT dessent DOT net> <dbl285$cis$1 AT sea DOT gmane DOT org> <42DE10BC DOT 8DF55946 AT dessent DOT net>
In-Reply-To: <42DE10BC.8DF55946@dessent.net>
X-IsSubscribed: yes

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Brian Dessent on 7/20/2005 2:52 AM:
> I think it would depend on what packages you upgraded.  It could be that
> the default buffer size somewhere has changed.  If it was quite large to
> begin with, and then was reduced, you would see the error more often.  I
> don't think the SIGPIPE behavior itself has changed, it has always been
> the case that a writer to a broken pipe receives the signal.  But it can
> be kind of racey if both the writer and reader are exiting.  Or, it
> could be that bash 2.x supressed that message while bash 3.x doesn't.

The pipe buffer sizes did not change (those are controlled by
cygwin1.dll).  But yes, if you look at /usr/share/doc/bash-3.0/CHANGES,
note this line:

nnn. The shell now reports on processes that dump core due to signals when
     invoked as `-c command'.

man uses the system() call, which indeed invokes /bin/sh (now bash) as `-c
command'.  In particular, the command being passed can be determined by
`man -d'; in the case of g++, command is (more or less):

'(cd /usr/share/man && (echo ".pl 1100i"; /usr/bin/gunzip -c
/usr/share/man/man1/g++.1.gz ;echo ".\\\""; echo ".pl \n(nlu+10")
|/usr/bin/tbl |/usr/binnroff -c -mandoc 2>/dev/null |less -s)'

OK, so gunzip didn't really dump core, but it does die due to a signal
(SIGPIPE) when not all of its output is read by less, and bash (aka
/bin/sh) is running it as -c command, hence the warning.

Now here's where the man maintainer might be able to help.  By changing
the command that gets passed to bash, you can tell bash to ignore SIGPIPE
(which gets inherited to all child processes).  This stops the SIGPIPE,
but instead gives the error EPIPE when gunzip tries to write to stdout,
which gunzip warns us about on stderr.  So we also need to ignore gunzip's
warning.  In other words, if man were to attempt this command, the error
message disappears!

'(cd /usr/share/man && (trap "" PIPE; echo ".pl 1100i"; /usr/bin/gunzip -c
/usr/share/man/man1/g++.1.gz ;echo ".\\\""; echo ".pl \n(nlu+10")
2>/dev/null |/usr/bin/tbl |/usr/binnroff -c -mandoc 2>/dev/null |less -s)'

But I don't know enough about man to figure out how to add 'trap "" PIPE;'
and the first '2>/dev/null' into the attempted command.  And this will
probably affect man installations on other platforms, so it may be worth
reporting upstream.

- --
Life is short - so eat dessert first!

Eric Blake             ebb9 AT byu DOT net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC3kl084KuGfSFAYARAoGQAKCgv7rQYXAq1wTCWp/t8acjPvBJNQCgywuG
qD1bvWgs9VlsWmae2iWKQKM=
=cEz+
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019