Bug 51231

Summary: Bug in GREP causes raid initialization to fail
Product: [Retired] Red Hat Linux Reporter: Need Real Name <eglidan>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: Brock Organ <borgan>
Severity: high Docs Contact:
Priority: medium    
Version: 7.1CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-08-08 16:53:12 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 Need Real Name 2001-08-08 16:53:08 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0b; Windows 98)

Description of problem:
Acording to every page I've ever seen, the command "grep 
^raiddev /etc/raidtab" should return lines where the characters "raiddev" 
are the first non-whitespace characters on the line. However, grep 2.4.2 
has a bug that is forcing that command to return null unless there is NO 
whitespace before the search string. Because it return only strings with 
NO whitespace on the line before the characters, the inittab scripts 
assume no raid devices need to be started unless they begin on column 1. 
However, if there ARE raid devices to be started, they will not mount 
because they were not started. For the time being I have fixed this 
(somewhat) by removing the ^ from the grep line for raiddev. This works 
(albeit it is an ugly fix). Until the GNU/FSF guys get that bug fixed, it 
would be wise to include some kind of a work around.

How reproducible:
Always

Steps to Reproduce:
(example)
Raidtab file:
       raiddev /dev/md0
           raid-level              5
           nr-raid-disks           3
           nr-spare-disks          0
           persistent-superblock   1
           parity-algorithm        left-symmetric
           chunk-size              128k

           device                  /dev/hdb1
           raid-disk               0
           device                  /dev/hdc1
           raid-disk               1
           device                  /dev/hdd1
           raid-disk               2

1. grep raiddev /etc/raidtab
(returns "       raiddev /dev/md0")
2. grep ^raiddev /etc/raidtab
(returns "")
3. grep ^/dev /etc/fstab
(returns all lines with /dev as the first four characters on that line)


Actual Results:  as described above.

Expected Results:  grep on raidtab with ^raiddev should work, 
returning        raiddev /dev/md0


Additional info:

Bug reported on GNU bug tracking site.

Comment 1 Bill Nottingham 2001-08-08 21:56:54 UTC
Changed in 6.12-1 to "^[^#]*raiddev", which should work.

FWIW, it seems grep is using the right behavior here.