Re: SIGEPIPE after update to 8.1-RC2

2010-07-28 Thread Kostik Belousov
On Sun, Jul 25, 2010 at 01:48:16PM +0200, Jilles Tjoelker wrote:
> On Sun, Jul 18, 2010 at 12:20:33PM +1000, Sean wrote:
> > I'm getting the same thing; what shell are you using? I changed my shell 
> > on one machine from /bin/tcsh to /usr/local/bin/bash and problem 
> > disappeared.
> 
> That this workaround helps confirms that masked/ignored SIGPIPE is the
> problem. From a few shells I have tried, bash and zsh reset SIGPIPE to
> caught or default even if it was ignored (only in interactive mode,
> however), while tcsh, sh, mksh and ksh93 leave it ignored.
> 
> The underlying problem is the program that is passing the ignored/masked
> signal to child processes. Please check if the problem occurs with
> various ways to log in (text console, ssh, xterm, etc). Things like PAM
> modules may also cause problems here.
> 
> For example, sshd sets SIGPIPE to ignored, but resets it back to default
> before starting a child process, so assuming I read the code correctly
> it does not cause problems.

Hm.

pooma% cat
...
In the other shell,
pooma% ps auxww | grep cat
kostik 41346  0.0  0.0  5824  1084   2  I+   11:34PM   0:00.00 cat
pooma% procstat -i 41346 | grep PIPE
41346 cat  PIPE ---


pooma% sudo cat
...
and
pooma% ps auxww | grep cat
root   41360  0.0  0.0  5824  1084   2  S+   11:36PM   0:00.01 cat
pooma% procstat -i 41366 | grep PIPE
41366 cat  PIPE ---

And now
oma% sudo -k cat~
Password:
...
and
pooma% ps auxww | grep cat
root   41387  0.0  0.0  5824  1084   2  S+   11:39PM   0:00.01 cat
pooma% procstat -i 41387 | grep PIPE
41387 cat  PIPE -I-

This would describe both the observed behaviour and the reason why
I was unable to repeat it after the first run.

sudo changelog has a promising entry from 2010-06-09, but I definitely
not going to read sudo code. security/sudo maintainer Cc:ed.


pgpyabP7aBJrj.pgp
Description: PGP signature


Re: SIGEPIPE after update to 8.1-RC2

2010-07-25 Thread Jilles Tjoelker
On Sun, Jul 18, 2010 at 12:20:33PM +1000, Sean wrote:
> I'm getting the same thing; what shell are you using? I changed my shell 
> on one machine from /bin/tcsh to /usr/local/bin/bash and problem 
> disappeared.

That this workaround helps confirms that masked/ignored SIGPIPE is the
problem. From a few shells I have tried, bash and zsh reset SIGPIPE to
caught or default even if it was ignored (only in interactive mode,
however), while tcsh, sh, mksh and ksh93 leave it ignored.

The underlying problem is the program that is passing the ignored/masked
signal to child processes. Please check if the problem occurs with
various ways to log in (text console, ssh, xterm, etc). Things like PAM
modules may also cause problems here.

For example, sshd sets SIGPIPE to ignored, but resets it back to default
before starting a child process, so assuming I read the code correctly
it does not cause problems.

-- 
Jilles Tjoelker
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: SIGEPIPE after update to 8.1-RC2

2010-07-20 Thread Ruben van Staveren

On 20 Jul 2010, at 10:03, Jeremy Chadwick wrote:

> On Tue, Jul 20, 2010 at 09:19:39AM +0200, Ruben van Staveren wrote:
>> To me, this is a clear breakage and should be considered a show
>> stopper issue for 8.1-RELEASE.
> 
> Too late for that now…

Oh well, errata when the culprit is found…

I've filed this as misc/148781

> 
> ftp://ftp4.freebsd.org/pub/FreeBSD/releases/amd64/
> ftp://ftp4.freebsd.org/pub/FreeBSD/releases/i386/

Thanks!

> 
> -- 
> | Jeremy Chadwick   j...@parodius.com |
> | Parodius Networking   http://www.parodius.com/ |
> | UNIX Systems Administrator  Mountain View, CA, USA |
> | Making life hard for others since 1977.  PGP: 4BD6C0CB |

Regards,
Ruben___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: SIGEPIPE after update to 8.1-RC2

2010-07-20 Thread Sean

On 20/07/2010, at 5:19 PM, Ruben van Staveren wrote:

> Hi,
> 
> This happens during a "sudo portupgrade -va --batch"
> my shell is /bin/tcsh too. When I run "exec bash" after sudo -s and then do 
> the portupgrade the problem doesn't show up. 
> 
> To me, this is a clear breakage and should be considered a show stopper issue 
> for 8.1-RELEASE. All shells should be equally supported, especially when they 
> reside in /bin. Is there already an open pr on this ?
> 

No PR from me, and not a chance of a fix to 8.1 at this point, unless it really 
does cause breakage (not just a message, but actually stops things); the tag 
has been laid down and would need to be slid forward.

It's likely to be either of two things... a bug in sh, that using tcsh 
highlights because of differing signal setup; or a bug in tcsh that a bug fix 
in sh highlights. It's a bug that comes and goes in the history of FreeBSD, at 
least since early 2006 (based on 10 seconds with Google - 
http://www.linuxquestions.org/questions/*bsd-17/broken-pipe-432167/)


> Thanks,
>   Ruben  
> 
> 

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: SIGEPIPE after update to 8.1-RC2

2010-07-20 Thread Jeremy Chadwick
On Tue, Jul 20, 2010 at 09:19:39AM +0200, Ruben van Staveren wrote:
> To me, this is a clear breakage and should be considered a show
> stopper issue for 8.1-RELEASE.

Too late for that now...

ftp://ftp4.freebsd.org/pub/FreeBSD/releases/amd64/
ftp://ftp4.freebsd.org/pub/FreeBSD/releases/i386/

-- 
| Jeremy Chadwick   j...@parodius.com |
| Parodius Networking   http://www.parodius.com/ |
| UNIX Systems Administrator  Mountain View, CA, USA |
| Making life hard for others since 1977.  PGP: 4BD6C0CB |

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: SIGEPIPE after update to 8.1-RC2

2010-07-20 Thread Ruben van Staveren
Hi,

On 18 Jul 2010, at 4:20, Sean wrote:

> On 18/07/2010 1:24 AM, Alex Kozlov wrote:
>> Hi, stable
>> 
>> After updating my buildbox from 26 April 8-STABLE
>> to 8.1-RC2 I constantly getting SIGEPIPE
>> 
> 
> 
> [snip]
> 
> I'm getting the same thing; what shell are you using? I changed my shell on 
> one machine from /bin/tcsh to /usr/local/bin/bash and problem disappeared.

Another occasion where this problem acts up:

is marked as broken: does not build** Makefile possibly broken: 
mail/moztraybiff:
grep: write error: Broken pipe
moztraybiff-1.2.4_1
--->  Session ended at: Tue, 20 Jul 2010 09:04:41 +0200 (consumed 
00:03:01)/usr/local/sbin/portupgrade:1473:in `get_pkgname': Makefile broken 
(MakefileBrok
enError)
from /usr/local/sbin/portupgrade:623
from /usr/local/sbin/portupgrade:614:in `each'
from /usr/local/sbin/portupgrade:614
from /usr/local/sbin/portupgrade:588:in `catch'
from /usr/local/sbin/portupgrade:588
from /usr/local/lib/ruby/1.8/optparse.rb:1310:in `call'
from /usr/local/lib/ruby/1.8/optparse.rb:1310:in `parse_in_order'
from /usr/local/lib/ruby/1.8/optparse.rb:1306:in `catch'
from /usr/local/lib/ruby/1.8/optparse.rb:1306:in `parse_in_order'
from /usr/local/lib/ruby/1.8/optparse.rb:1254:in `catch'
from /usr/local/lib/ruby/1.8/optparse.rb:1254:in `parse_in_order'
from /usr/local/lib/ruby/1.8/optparse.rb:1248:in `order!'
from /usr/local/lib/ruby/1.8/optparse.rb:1241:in `order'
from /usr/local/sbin/portupgrade:565:in `main'
from /usr/local/lib/ruby/1.8/optparse.rb:791:in `initialize'
from /usr/local/sbin/portupgrade:229:in `new'
from /usr/local/sbin/portupgrade:229:in `main'
from /usr/local/sbin/portupgrade:2213

This happens during a "sudo portupgrade -va --batch"
my shell is /bin/tcsh too. When I run "exec bash" after sudo -s and then do the 
portupgrade the problem doesn't show up. 

To me, this is a clear breakage and should be considered a show stopper issue 
for 8.1-RELEASE. All shells should be equally supported, especially when they 
reside in /bin. Is there already an open pr on this ?

Thanks,
Ruben  


___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: SIGEPIPE after update to 8.1-RC2

2010-07-18 Thread Kostik Belousov
On Sun, Jul 18, 2010 at 12:11:50AM +0200, Jilles Tjoelker wrote:
> On Sat, Jul 17, 2010 at 06:24:55PM +0300, Alex Kozlov wrote:
> > After updating my buildbox from 26 April 8-STABLE
> > to 8.1-RC2 I constantly getting SIGEPIPE
> 
> > portsnap:
> > Fetching 4 metadata patches... done.
> > Applying metadata patches... done.
> > Fetching 0 metadata files... done.
> > Fetching 27 patches.1020... done.
> > Applying patches... done.
> > Fetching 3 new ports or files... done.
> > sort: write failed: standard output: Broken pipe
> > sort: write error
> > Removing old files and directories... done.
> 
> > sudo make -C /usr/ports/converters/ascii2binary:
> > ===>  Patching for ascii2binary-2.13_2
> > ===>  Applying FreeBSD patches for ascii2binary-2.13_2
> > ===>   ascii2binary-2.13_2 depends on shared library: intlgrep: writing 
> > output: Broken pipe
> > grep: writing output: Broken pipe
> [snip repetition]
> >  - found
> >  ===>  Configuring for ascii2binary-2.13_2
> 
> > Does anyone know something about this issue?
> 
> This looks more like the absence of SIGPIPE than an inappropriate
> SIGPIPE. I can reproduce both of those error messages by running the
> commands with SIGPIPE ignored. grep(1) seems to behave strangely on
> write errors, not aborting, for example
>   yes | { trap '' PIPE; grep -v foo; echo $? >&2; } | :
> prints an endless stream of error messages.
> 
> Note that sh(1) silently ignores attempts to change the disposition of
> signals that were ignored on entry to the shell, so a
>   trap - PIPE
> is unlikely to help you.
> 
> Similarly, SIGPIPE may be blocked (masked). Few programs expect this.
> 
> The -i and -j options in procstat should be helpful in finding what
> exactly is wrong with SIGPIPE. (These options are relatively new, but
> should be in 8.1.)

Might be, but now I have a feel that something more strange happens
there. One of my workstations does not exhibit the behaviour, while
another one did.

I composed the following grep wrapper to catch the situation you
guessed:

#!/bin/sh
disp=$(procstat -i $$ | awk '/PIPE/{print $4}')
if expr -- $disp : I >/dev/null ; then
echo "grep: SIGPIPE ignored" >/dev/tty
kill -STOP $$
fi
exec /usr/bin/grep "$@"

Amazingly enough, the messages stopped spitting. Even more, I cannot
reproduce them on the machine without the wrapper.

Side note: despite ports/Mk/bsd.commands.mk defining GREP and EGREP,
there are still several instances of the direct grep invocation
among Mk/* files. Do port people consider this worth fixing ?


pgpQuV0FjJApq.pgp
Description: PGP signature


Re: SIGEPIPE after update to 8.1-RC2

2010-07-17 Thread Sean

On 18/07/2010 1:24 AM, Alex Kozlov wrote:

Hi, stable

After updating my buildbox from 26 April 8-STABLE
to 8.1-RC2 I constantly getting SIGEPIPE




[snip]

I'm getting the same thing; what shell are you using? I changed my shell 
on one machine from /bin/tcsh to /usr/local/bin/bash and problem 
disappeared.




--
Adios
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: SIGEPIPE after update to 8.1-RC2

2010-07-17 Thread Jilles Tjoelker
On Sat, Jul 17, 2010 at 06:24:55PM +0300, Alex Kozlov wrote:
> After updating my buildbox from 26 April 8-STABLE
> to 8.1-RC2 I constantly getting SIGEPIPE

> portsnap:
> Fetching 4 metadata patches... done.
> Applying metadata patches... done.
> Fetching 0 metadata files... done.
> Fetching 27 patches.1020... done.
> Applying patches... done.
> Fetching 3 new ports or files... done.
> sort: write failed: standard output: Broken pipe
> sort: write error
> Removing old files and directories... done.

> sudo make -C /usr/ports/converters/ascii2binary:
> ===>  Patching for ascii2binary-2.13_2
> ===>  Applying FreeBSD patches for ascii2binary-2.13_2
> ===>   ascii2binary-2.13_2 depends on shared library: intlgrep: writing 
> output: Broken pipe
> grep: writing output: Broken pipe
[snip repetition]
>  - found
>  ===>  Configuring for ascii2binary-2.13_2

> Does anyone know something about this issue?

This looks more like the absence of SIGPIPE than an inappropriate
SIGPIPE. I can reproduce both of those error messages by running the
commands with SIGPIPE ignored. grep(1) seems to behave strangely on
write errors, not aborting, for example
  yes | { trap '' PIPE; grep -v foo; echo $? >&2; } | :
prints an endless stream of error messages.

Note that sh(1) silently ignores attempts to change the disposition of
signals that were ignored on entry to the shell, so a
  trap - PIPE
is unlikely to help you.

Similarly, SIGPIPE may be blocked (masked). Few programs expect this.

The -i and -j options in procstat should be helpful in finding what
exactly is wrong with SIGPIPE. (These options are relatively new, but
should be in 8.1.)

-- 
Jilles Tjoelker
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: SIGEPIPE after update to 8.1-RC2

2010-07-17 Thread Alex Kozlov
On Sat, Jul 17, 2010 at 06:58:29PM +0200, Ronald Klop wrote:
> Try rebuilding bash or sh or whatever you are using as shell. I'm not sure  
> though.
I done only preliminary testing, but replacing /bin/sh by one from
8.0-RELEASE seems to help. Thanks.
Now I will try to find particular commit that broke sh.


--
Adios
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: SIGEPIPE after update to 8.1-RC2

2010-07-17 Thread Ronald Klop
Try rebuilding bash or sh or whatever you are using as shell. I'm not sure  
though.


Ronald.


On Sat, 17 Jul 2010 17:24:55 +0200, Alex Kozlov  wrote:


Hi, stable

After updating my buildbox from 26 April 8-STABLE
to 8.1-RC2 I constantly getting SIGEPIPE

portsnap:
Fetching 4 metadata patches... done.
Applying metadata patches... done.
Fetching 0 metadata files... done.
Fetching 27 patches.1020... done.
Applying patches... done.
Fetching 3 new ports or files... done.
sort: write failed: standard output: Broken pipe
sort: write error
Removing old files and directories... done.

sudo make -C /usr/ports/converters/ascii2binary:
===>  Patching for ascii2binary-2.13_2
===>  Applying FreeBSD patches for ascii2binary-2.13_2
===>   ascii2binary-2.13_2 depends on shared library: intlgrep: writing  
output: Broken pipe

grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
 - found
 ===>  Configuring for ascii2binary-2.13_2

Does anyone know something about this issue?


--
Adios
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"