Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Feb 2026 18:15:25 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 293217] grep(1) reads EOF twice from interactive stdin before quitting
Message-ID:  <bug-293217-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293217

            Bug ID: 293217
           Summary: grep(1) reads EOF twice from interactive stdin before
                    quitting
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: freebsd@tim.thechases.com

Running `grep(1)` interactively and immediately pressing control+d to send an
EOF, it registers the ^D but then requires a *second* control+d to actually
quit.  On both OpenBSD & Ubuntu, grep(1) quits immediately at the first
control+d as expected:

    $ grep x
    ^D
    ^D

If a line of any other input is provided before the control+d it behaves
properly.

    $ grep x
    hello
    ^D

(this was encountered while testing the exit status code for `grep` and `grep
-v` on various inputs including empty)

-- 
You are receiving this mail because:
You are the assignee for the bug.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-293217-227>