buggrep - Bugs: bug #31928, grep should exit(2) when memory is...


You are not allowed to post comments on this tracker with your current authentication level.

bug #31928: grep should exit(2) when memory is exhausted

Submitted by:  None
Submitted on:  Sun 19 Dec 2010 04:55:49 AM UTC  
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Mon 20 Dec 2010 03:14:29 PM UTC, comment #1:

Thank you for the bug report. This bug has been fixed in the
development sources, which can be downloaded using git from

Paolo Bonzini <bonzini>
Sun 19 Dec 2010 04:55:49 AM UTC, original submission:

When grep exhausts memory due to trying to read()
or mmap() a large binary file, it prints

grep: memory exhausted

on stderr, then exits with exit status, 1.

I expect the failure, but I believe that
it should exit(2), or something greater than 1,
in order to distinguish this type of failure
from simply a failure to find a match.

The EXIT STATUS section of the man page for grep
says that grep exits with 2 (or greater) in case
of errors, so I believe this is a bug, in the
sense that grep does not behave according to its
documentation. But, even if the man page were
not explicit about that, grep ought to make it
possible for errors to be distinguished from the
case where no matches are found.

-- Guy Shaw



No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by bonzini (Posted a comment)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 20 Dec 2010 03:14:29 PM UTCbonziniStatusNone=>Fixed

    Back to the top

    Powered by Savane 3.1-cleanup1