bug-grep
[Top][All Lists]
Advanced

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

bug#32943: grep pattern < fifo fails on Cygwin (and MinGW), but not on L


From: Houder
Subject: bug#32943: grep pattern < fifo fails on Cygwin (and MinGW), but not on Linux
Date: Mon, 08 Oct 2018 20:10:35 +0200
User-agent: XS4ALL Webmail

On 2018-10-08 17:49, Paul Eggert wrote:
On 10/8/18 12:35 AM, Houder wrote:
grep terminates with an error on Cygwin because lseek() on Cygwin fails to
ascertain that it is applied to a FIFO.


That sounds like a bug in Cygwin, then. Can you find out exactly why
it occurs, by using GDB within Cygwin? Then you can file a bug report
with the Cygwin folks.

Yes, it _is_ a bug in cywin1.dll (i.e. the executive). No, I cannot find
out _exactly_ why it occurs (see below). A "bug report" has been filed,

Cygwin has no official bug tracker. A bug is reported on the mailinglist.

I have reported my findings here:

    https://cygwin.com/ml/cygwin/2018-10/msg00062.html

E. Blake, one of members on your list, has already acknowledged that the
Cygwin executive must be fixed.

Possibly the bug is something like the following: grep calls lseek
(fd, 0, SEEK_CUR). The Cygwin lseek implementation asks MS-Windows
what the file offset is, gets an error because the file descriptor is
that of a pipe, and somehow turns that into EINVAL. Cygwin should turn
it into ESPIPE instead.

Cygwin has been written in C++ (it would take me a very long time to get
familiar with the implementation).

lseek() is implemented in winsup/cygwin/syscalls.cc. The "real" lseek()
however is implemented in one of the many "handlers", depending on the
device type on which lseek() is applied (I am guessing).

Apparently, "nothing" has been implemented for a fifo, and as result
of that the basic handler fhandler_base::lseek() in

    winsup/cygwin/fhandler.cc (1031) is invoked.

Here NtQueryInformationFile() is called, which fails with

ERROR_INVALID_PARAMETER (87), which Cygwin turns into EINVAL (22).

We have to wait until Corinna Vinschen returns from holidays (end of
october), because Corinna Vinschen is the only one who can deal with
the executive.

Regards,
Henri











reply via email to

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