Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 99038

Summary: sys-apps/hotplug-20040923 firmware.agent broken
Product: Gentoo Linux Reporter: Philip Lawatsch <philip>
Component: [OLD] Core systemAssignee: Greg Kroah-Hartman (RETIRED) <gregkh>
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---
Bug Depends on: 145809    
Bug Blocks:    

Description Philip Lawatsch 2005-07-14 13:10:03 UTC
firmware.agent tries to be smarter than usb.agent. usb.agent gets the path sysfs
is mounted by staticall using /sys.
firmware.agent however does this: 
SYSFS=$(sed -n 's/^.* \([^ ]*\) sysfs .*$/\1/p' /proc/mounts)

This works fine as long as sysfs is mounted only ONCE. If its mounted more than
once the variable will contain serveral lines and when used in 

cp will silently fail (.../data is a file, and 2 or more files cant be copied to
a file).

So either limit the output of $(sed -n 's/^.* \([^ ]*\) sysfs .*$/\1/p'
/proc/mounts) to one line (but make sure this directory is accessible) or skip
it all together and use /sys statically.

The way I encountered the bug was that a genkernel initrd failed to unmount its
/sys and thus I had it mounted twice.
On my desktop machine I've also got it mounted twice, once in my 64bit system
and once in a 32bit chroot. So its not uncommon to have such a situation

Reproducible: Always
Steps to Reproduce:
1. mkdir /mnt/foobar
2. mount sysfs /mnt/foobar -t sysfs
3. do something which will trigger a firmware upload 

Actual Results:  
doesnt work since cp will get passed something like 
cp "/lib/firmware/something" /sys/$DEVPATH/ /mnt/foobar/$DEVPATH/data

Expected Results:  
limit output to one line, either by setting SYSFS=/sys or by testing each
possible line and then using one which will work.
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2005-07-14 16:01:54 UTC
Reopen after you've posted what ebuild and version is this bug about... 
Comment 2 Philip Lawatsch 2005-07-15 06:09:15 UTC
Sorry, I though it was clear.
Aw, its sys-apps/hotplug-20040923 (which is the latest version)
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2007-09-04 00:04:17 UTC
sys-apps/hotplug is useless with any recent udev version, and 2.4 kernels are no longer supported. Unmerge it and move on.