Bug 74167 - mkinitrd breaks on legal content of /etc/modules.conf
mkinitrd breaks on legal content of /etc/modules.conf
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: mkinitrd (Show other bugs)
7.3
All Linux
medium Severity medium
: ---
: ---
Assigned To: Erik Troan
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-09-17 03:21 EDT by Michal Jaegermann
Modified: 2007-04-18 12:46 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-01-14 17:33:42 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Simple patch to handle all legal /etc/modules.conf files in mkinitrd (1.59 KB, patch)
2002-09-17 03:23 EDT, Michal Jaegermann
no flags Details | Diff

  None (edit)
Description Michal Jaegermann 2002-09-17 03:21:39 EDT
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 03:23:33 EDT
Created attachment 76345 [details]
Simple patch to handle all legal /etc/modules.conf files in mkinitrd
Comment 2 Michal Jaegermann 2002-09-17 03:38:13 EDT
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 11:31:27 EDT
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 17:33:42 EST
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

Note You need to log in before you can comment on or make changes to this bug.