Bug 108757 - devfs-detection in %pre is naive and wrong
Summary: devfs-detection in %pre is naive and wrong
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: MAKEDEV   
(Show other bugs)
Version: 1.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Nalin Dahyabhai
QA Contact: Brock Organ
URL:
Whiteboard:
Keywords:
Depends On:
Blocks: 130526
TreeView+ depends on / blocked
 
Reported: 2003-11-01 02:37 UTC by Enrico Scholz
Modified: 2007-04-18 16:59 UTC (History)
2 users (show)

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


Attachments (Terms of Use)

Description Enrico Scholz 2003-11-01 02:37:45 UTC
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 20:21:47 UTC
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 20:43:31 UTC
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-26 01:13:44 UTC
Does 3.7-1 improve things?

Comment 4 Nalin Dahyabhai 2004-09-14 15:26:30 UTC
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.