Bug 77422

Summary: mkinitrd gives syntax error (line 315) when kudzu detects >1 SCSI device
Product: [Retired] Red Hat Linux Reporter: Paul Clements <paul.clements>
Component: mkinitrdAssignee: Peter Jones <pjones>
Status: CLOSED NEXTRELEASE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0   
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: 2006-08-04 20:32:16 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 Paul Clements 2002-11-06 20:37:40 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830

Description of problem:
mkinitrd displays a shell syntax error:

/sbin/mkinitrd: line 315: [: too many arguments

The fix is as follows, I believe:

--- /sbin/mkinitrd.ORIG 2002-11-06 15:30:10.000000000 -0500
+++ /sbin/mkinitrd      2002-11-06 15:30:39.000000000 -0500
@@ -311,7 +311,7 @@
        dev=$(mount | awk "/ on ${esc} / { print \$1 }" | sed 's/[0-9]*$//' |
cut -d/ -f3)
        if [ "$(echo $dev | cut -c1-2)" = sd ]; then
            host=$(kudzu --probe -b scsi |
-             gawk '/^device: '${dev}'/,/^host:/ { if (/^host/) print $2; }') 
+             gawk '/^device: '${dev}'/,/^host:/ { if (/^host/) { print $2;
exit; } }') 
            if [ -d /proc/scsi/usb-storage-${host} ]; then
                needusb=1
            fi


This way, only the first SCSI device that is detected, and matches, will be checked.

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


How reproducible:
Always

Steps to Reproduce:
1.run mkinitrd on a system with more than 1 SCSI device (that kudzu can detect)
and also with root or /boot FS on an sd[a-z] device

	

Actual Results:  syntax error, as described above

Expected Results:  no syntax error, and correct USB handling (not sure if that's
broken because of this or not, I don't actually have USB)

Additional info:

Comment 1 Jeremy Katz 2003-01-06 04:58:27 UTC
thanks for the fix, added to cvs and will be in 3.4.34-1

Comment 2 Bill Nottingham 2006-08-04 20:32:16 UTC
Red Hat Linux and Red Hat Powertools are currently no longer supported by Red
Hat, Inc. In an effort to clean up bugzilla, we are closing all bugs in MODIFIED
state for these products.

However, we do want to make sure that nothing important slips through the
cracks. If, in fact, these issues are not resolved in a current Fedora Core
Release (such as Fedora Core 5), please open a new issues stating so. Thanks.