Bug 148

Summary: While installing a new package, mkinitrd seems to failed with too much arguments
Product: Mageia Reporter: John Balcaen <balcaen.john>
Component: RPM PackagesAssignee: Mageia Bug Squad <bugsquad>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: release_blocker CC: arnaud.patard, ennael1, pterjan, thierry.vignaud, tmb
Version: CauldronKeywords: PATCH
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Source RPM: mkinitrd-6.0.93-21.mga1.src.rpm CVE:
Status comment:
Attachments: Mkinitrd log
Result of bash --norc -x ./mkinitrd /boot/initrd-2.6.38-desktop-1.mga.img 2.6.38-desktop-1.mga -f

Description John Balcaen 2011-02-21 13:28:06 CET
LC_ALL=C mkinitrd /boot/initrd-2.6.37-desktop-3.mga.img 2.6.37-desktop-3.mga -v -f                                                               
Creating initramfs                                                                                                                                                   
/sbin/mkinitrd: line 1099: [: too many arguments                                                                                                                     
Looking for driver for /dev/sda1 in /sys/block/sda/sda1                                                                                                              
Looking for deps of module scsi:t-0x00: crc-t10dif scsi_mod sd_mo

Version-Release number of selected component (if applicable):
mkinitrd-6.0.93-21.mga1

How reproducible:
always

Steps to Reproduce:
1.recreate your mkinitrd file with
2. mkinitrd /boot/initrd-2.6.37-desktop-3.mga.img 2.6.37-desktop-3.mga -v -f
3. read the first line

It's probably harmless but just in case.


cat /etc/sysconfig/mkinitrd                                                                                                                      
# This file can be used to alter the default behaviour of mkinitrd.                                                                                                  
# It is a bash shell script that is sourced by mkinitrd before option parsing                                                                                        
# so variables set there will be used by mkinitrd instead of defaults.                                                                                               
# Be aware that modifying this file is not supported and should be done only                                                                                         
# as a workaround to specific problems.                                                                                                                              
# To see what can be set here check the mkinitrd script (hint: look at the                                                                                           
# beginning of the script and at lines following 'while [ $# -gt 0 ]; do')                                                                                           
Attached in the log of mkinitrd.                                                          

Reproducible: 

Steps to Reproduce:
Comment 1 John Balcaen 2011-02-21 13:29:09 CET
Created attachment 21 [details]
Mkinitrd log

Mkinitrd log created with a LC_ALL=C mkinitrd /boot/initrd-2.6.37-desktop-3.mga.img 2.6.37-desktop-3.mga -v -f
Comment 2 John Balcaen 2011-03-25 00:34:43 CET
Created attachment 164 [details]
Result of bash --norc -x ./mkinitrd /boot/initrd-2.6.38-desktop-1.mga.img 2.6.38-desktop-1.mga -f

Attached is the result of bash --norc -x ./mkinitrd /boot/initrd-2.6.38-desktop-1.mga.img 2.6.38-desktop-1.mga -f as suggested by rtp on irc
The file is bzip2 since it's 2.5 mo :)
Ahmad Samir 2011-03-25 03:15:53 CET

CC: (none) => pterjan, tmb

Comment 3 Pascal Terjan 2011-03-25 09:49:29 CET
It seems /sys${syspath}/device/*:*/driver/module returns several files because of usb devices appearing in /sys/devices/pci0000:00/0000:00:1d.1/usb7
Comment 4 Arnaud Patard 2011-03-29 23:43:35 CEST
(In reply to comment #3)
> It seems /sys${syspath}/device/*:*/driver/module returns several files because
> of usb devices appearing in /sys/devices/pci0000:00/0000:00:1d.1/usb7

for the records, it happens with every webcam having a button. Reproduced with an old pwc
webcam.

One possible fix may be :

@@ -1096,10 +1096,15 @@ fi
 if [ -z "${kbddrivers##*/*}" ]; then
     withusb=1
     for syspath in $(echo ${kbddrivers} | sed 's/Sysfs=//g'); do
-           [ -z "${syspath##*/*}" ] && [ -L /sys${syspath}/device/*:*/driver/module ] && \
-            findmodule -$(basename $(readlink /sys${syspath}/device/*:*/driver/module))
+        if [ -z "${syspath##*/*}" ]; then
+            d=$(readlink /sys${syspath}/device/driver)
+            [[ "$d" =~ usbhid ]] && \
+            [ -L /sys${syspath}/device/*:*/driver/module ] && \
+                findmodule -$(basename $(readlink /sys${syspath}/device/*:*/driver/module)) &&
+                findmodule -usbhid
+        fi
+
     done
-    findmodule -usbhid
 fi
 
 if [ "$withusb" == "1" ]; then

Pascal, any opinion ?

CC: (none) => arnaud.patard

Comment 5 John Balcaen 2011-05-17 04:01:06 CEST
ping ? 
(so we can fix it for mageia 1 ? :) )
Thierry Vignaud 2011-05-17 10:18:30 CEST

Keywords: (none) => PATCH
Priority: Normal => release_blocker
CC: (none) => thierry.vignaud

Comment 6 Pascal Terjan 2011-05-17 12:26:17 CEST
It seems correct but I couldn't test it yet, it would be great if someone else could check it :)
Comment 7 John Balcaen 2011-05-17 14:28:59 CEST
I can confirm that this patch removed the line 1099: [: too many arguments when it's used on current mkinitrd.
Comment 8 John Balcaen 2011-05-17 21:23:03 CEST
& of course i can still boot with the new initrd created by the patched mkinitrd
Comment 9 Anne Nicolas 2011-05-17 22:39:38 CEST
Please update with mkinitrd-6.0.93-23.mga1 (thanks rtp)

Status: NEW => RESOLVED
CC: (none) => ennael1
Resolution: (none) => FIXED