Bug 79350 - possible bad code in grep
Summary: possible bad code in grep
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: grep
Version: 7.3
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: Mike McLean
Depends On:
TreeView+ depends on / blocked
Reported: 2002-12-10 17:12 UTC by Mike Iglesias
Modified: 2007-04-18 16:48 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2004-10-11 11:19:20 UTC

Attachments (Terms of Use)

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.

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