GNU bug report logs - #20902
[BUG] hang at fifo despite of '-D skip'

Previous Next

Package: grep;

Reported by: Uwe Koloska <kolewu <at> koloro.de>

Date: Fri, 26 Jun 2015 15:15:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Uwe Koloska <kolewu <at> koloro.de>
Subject: bug#20902: closed (Re:  [BUG] hang at fifo despite of '-D skip')
Date: Fri, 26 Jun 2015 23:52:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#20902: [BUG] hang at fifo despite of '-D skip'

which was filed against the grep package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 20902 <at> debbugs.gnu.org.

-- 
20902: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20902
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Uwe Koloska <kolewu <at> koloro.de>
Cc: 20902-done <at> debbugs.gnu.org
Subject: Re:  [BUG] hang at fifo despite of '-D skip'
Date: Fri, 26 Jun 2015 16:50:52 -0700
[Message part 3 (text/plain, inline)]
Thanks for reporting this bug.  I installed the attached into the grep master on 
savannah, and it (or something like it) should appear in the next release.
[0001-grep-don-t-hang-on-command-line-fifo-if-D-skip.patch (text/x-diff, attachment)]
[Message part 5 (message/rfc822, inline)]
From: Uwe Koloska <kolewu <at> koloro.de>
To: bug-grep <at> gnu.org
Subject: [BUG] hang at fifo despite of '-D skip'
Date: Fri, 26 Jun 2015 11:40:29 +0200
Hello,

'grep -D skip' hangs when examining a FIFO.

This is a regression. It has been working since 2.5.2 (commit
5c7194f9e739082dc14f75769f2c19a39bb6cf84).
Debian 6.0.10 has 2.6.3 and there it's working, too. But 2.12 in debian
7.8 has the problem.  Don't know exactly when it changed.

The help (and manual) states:
  -D, --devices=ACTION      how to handle devices, FIFOs and sockets;
                            ACTION is 'read' or 'skip'

From this I expect, that grep will skip a FIFO and not block while
trying to handle it.

You can test for this error with this commands:

-8<-----------------------------------------------------
mkfifo myfifo
grep -D skip foo myfifo &
PID=$!
sleep 1
kill $PID 2>/dev/null && echo fail || echo ok
-8<-----------------------------------------------------

and here is the same idea as test for the test-suite:

#+FILE: tests/skip-fifo
-8<-----------------------------------------------------
#!/bin/sh
# grep must ignore a fifo when started with -D skip

. "${srcdir=.}/init.sh"; path_prepend_ ../src

mkfifo myfifo

grep -D skip foo myfifo &
PID=$!
# just to make sure
sleep 1
kill $PID && fail=1

# the other way round
grep foo myfifo &
PID=$!
# just to make sure
sleep 1
kill $PID || fail=1

Exit $fail
-8<-----------------------------------------------------

Best regards
Uwe Koloska



This bug report was last modified 9 years and 331 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.