Bug 79350

Summary: possible bad code in grep
Product: [Retired] Red Hat Linux Reporter: Mike Iglesias <iglesias>
Component: grepAssignee: Tim Waugh <twaugh>
Status: CLOSED WONTFIX QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-11 11:19:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mike Iglesias 2002-12-10 17:12:18 UTC
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 17:17:21 UTC
I think in that context the expression will behave the same regardless.