Bug 108757 - devfs-detection in %pre is naive and wrong
devfs-detection in %pre is naive and wrong
Status: CLOSED RAWHIDE
Product: Red Hat Raw Hide
Classification: Retired
Component: MAKEDEV (Show other bugs)
1.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Nalin Dahyabhai
Brock Organ
:
Depends On:
Blocks: 130526
  Show dependency treegraph
 
Reported: 2003-10-31 21:37 EST by Enrico Scholz
Modified: 2007-04-18 12:59 EDT (History)
2 users (show)

See Also:
Fixed In Version: 3.12.1-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-09-14 11:26:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Enrico Scholz 2003-10-31 21:37:45 EST
Description of problem:

The %pre script of 'dev' checks for devfs by parsing /proc/mounts.
This is wrong since:

- chroot-installations will fail when host-system has devfs, although 
  'dev' could be installed into the chroot without problems

- installations will fail were /dev is on an own, writable partition 
  (this is again a chroot issue; e.g. /dev in build-chroot 
  environments could be a commonly shared, read-only mountpoint) 


IMO a better way to decide whether /dev is devfs, is to check the
device-number. E.g. a better %pre scriptlet could be

|  N=$(stat -c '%D' /dev)
|  test "$N" != 6 || {
|    echo $"Cannot install the dev package: mounted devfs detected."
|    exit 1
|  }


Version-Release number of selected component (if applicable):

MAKEDEV-3.3.8-2
Comment 1 Nalin Dahyabhai 2003-11-25 15:21:47 EST
I agree that this is a problem case, but I don't think that checking
for a magic device number will work dependably enough.  Device numbers
appear to be assigned as-needed for non-device mount points (on my
test system, /dev/pts is device 6, /proc/bus/usb got 7, /dev/shm is 8,
and so on), and 6 happens to be the first-available at this time.
Comment 2 Enrico Scholz 2003-11-25 15:43:31 EST
Mmmh, you are right. But checking for major==0 should be enough.
Additionally, atime==0 could be checked also:

| D=$(stat -c '%X' /dev)
| test "$N" -lt 256 -a $D = 0 ...

Usual harddisks are 0x300 or 0x800, loop is 0x700 and RAID is 0x900,
so  all relevant cases are catched.

NFS (which gets major==0 also) will have atime > 0.
Comment 3 Nalin Dahyabhai 2004-08-25 21:13:44 EDT
Does 3.7-1 improve things?
Comment 4 Nalin Dahyabhai 2004-09-14 11:26:30 EDT
3.12.1-1 does away with dev completely, %pre and all.

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