Bug 74167 - mkinitrd breaks on legal content of /etc/modules.conf
Summary: mkinitrd breaks on legal content of /etc/modules.conf
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: mkinitrd
Version: 7.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Erik Troan
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-09-17 07:21 UTC by Michal Jaegermann
Modified: 2007-04-18 16:46 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2003-01-14 22:33:42 UTC
Embargoed:


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

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


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