bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Uwe Koloska
Subject: bug#20902: [BUG] hang at fifo despite of '-D skip'
Date: Fri, 26 Jun 2015 11:40:29 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]