Bug 74167

Summary: mkinitrd breaks on legal content of /etc/modules.conf
Product: [Retired] Red Hat Linux Reporter: Michal Jaegermann <michal>
Component: mkinitrdAssignee: Erik Troan <ewt>
Status: CLOSED WONTFIX QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: herrold
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: 2003-01-14 22:33:42 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:
Attachments:
Description Flags
Simple patch to handle all legal /etc/modules.conf files in mkinitrd none

Description Michal Jaegermann 2002-09-17 07:21:39 UTC
Description of Problem:

'mkinitrd' is broken in such sense that it is unable to reasonably
handle even simple /etc/modules.conf conditional constructs like these:

if -f /lib/modules/`uname -r`/kernel/drivers/scsi/sym53c8xx_2/sym53c8xx_2.o
   alias scsi_hostadapter sym53c8xx_2
else
   alias scsi_hostadapter sym53c8xx
endif

which is both legal and very reasonable in handling multiple kernels
with possibly different module lists.  This is a very simple example
and quite a bit more complicated are possible.

Instead of feeble attempts of parsing /etc/modules.conf in 'mkinitrd'
this script should rely on an output of 'modprobe -c' which _has_
to do that properly, and normalizes its output, or it is broken.

Attached simple patch is for version 3.3.10 but some variations of
it will apply all over.

Comment 1 Michal Jaegermann 2002-09-17 07:23:33 UTC
Created attachment 76345 [details]
Simple patch to handle all legal /etc/modules.conf files in mkinitrd

Comment 2 Michal Jaegermann 2002-09-17 07:38:13 UTC
Oops!  A space is missing. The patch should read

 options=$( /sbin/modprobe -c | grep "^options $module " | \

instead of 

 options=$( /sbin/modprobe -c | grep "^options $module" | \

or, alternatively, "$module" can be tested in a subseqent while-loop.

Comment 3 Michal Jaegermann 2002-09-17 15:31:27 UTC
Sigh!  This still will not work in general without adding to modprobe an
option to request a configuration for a specified kernel instead of the
current one.  This is not likely be very difficult and/or invasive.
Trying to reparse modules.conf correctly in a shell script likely will
be always a very dicey proposition.

Comment 4 Erik Troan 2003-01-14 22:33:42 UTC
as you've noted, this is not going to be straightforward to fix. if the upstream
modutils folks decide to help out I'll add the support to mkinitrd