Bug 79350 - possible bad code in grep
possible bad code in grep
Product: Red Hat Linux
Classification: Retired
Component: grep (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Mike McLean
Depends On:
  Show dependency treegraph
Reported: 2002-12-10 12:12 EST by Mike Iglesias
Modified: 2007-04-18 12:48 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-11 07:19:20 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Mike Iglesias 2002-12-10 12:12:18 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.18-18.7.xsmp i686)

Description of problem:
I've been having problems with the pcmcia/hotplug startup in RH 7.3, and after
reading bug 61705 (and noting that RH 7.3 comes with the fixed grep), it's still
not working for me.  It appears that grep is exiting with status 1 in the
is_available function in /etc/sysconfig/network-scripts/network-functions, so I
started poking around in the grep source code.  I noticed this in grep.c, around
line 1636:

  /* POSIX.2 says that -q overrides -l, which in turn overrides the
     other output options.  */
  if (exit_on_match)
    list_files = 0;
  if (exit_on_match | list_files)  
      count_matches = 0;
      done_on_match = 1;

I think the second "if" needs a "||" instead of a "|", otherwise the if
statement will never be true, and the code will never be executed.

I have not had a chance to test this on the problematic system yet, so I don't
know if it fixes my problem.

Version-Release number of selected component (if applicable):

How reproducible:
Didn't try

Additional info:
Comment 1 Tim Waugh 2002-12-10 12:17:21 EST
I think in that context the expression will behave the same regardless.

Note You need to log in before you can comment on or make changes to this bug.