public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eric Blake <ebb9@byu.net>
To: cygwin@cygwin.com
Subject: Re: man - broken pipe [Attn: man maintainer]
Date: Wed, 20 Jul 2005 13:18:00 -0000	[thread overview]
Message-ID: <42DE4975.4090409@byu.net> (raw)
In-Reply-To: <42DE10BC.8DF55946@dessent.net>

-----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@byu.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/

  reply	other threads:[~2005-07-20 12:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-20  7:28 man - broken pipe Krzysztof Duleba
2005-07-20  8:17 ` Brian Dessent
2005-07-20  8:34   ` Krzysztof Duleba
2005-07-20  8:48     ` Brian Dessent
2005-07-20 13:18       ` Eric Blake [this message]
2005-07-21 13:32         ` man - broken pipe [Attn: man maintainer] Dr. Volker Zell
2005-07-20 14:11       ` man - broken pipe Krzysztof Duleba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42DE4975.4090409@byu.net \
    --to=ebb9@byu.net \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).