[Bug 8796] New: grep exit code, should be >1 in errors

bugzilla at busybox.net bugzilla at busybox.net
Tue Mar 15 22:02:05 UTC 2016


https://bugs.busybox.net/show_bug.cgi?id=8796

            Bug ID: 8796
           Summary: grep exit code, should be >1 in errors
           Product: Busybox
           Version: 1.24.x
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Standard Compliance
          Assignee: unassigned at busybox.net
          Reporter: aurelio at aurelio.net
                CC: busybox-cvs at busybox.net
  Target Milestone: ---

POSIX says grep exit code should be 2 (or greater) when an error occurs.

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html

   * 0 One or more lines were selected.
   * 1 No lines were selected.
   * >1 An error occurred.

That's how GNU grep behaves:

    $ grep '\(' /etc/passwd; echo $?
    grep: Unmatched ( or \(
    2

But Busybox is currently returning 1, which is the exit code we rely to check
if the pattern not matched:

    / # grep '\(' /etc/passwd; echo $?
    grep: bad regex '\(': Missing ')'
    1

Could you please make it return 2 in case of errors?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list