From 5c20cad30bd34960ae22638cba3f32353914fdbb Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 24 Apr 2007 15:42:01 +0000 Subject: [PATCH] Patch from Kay Sievers for assuming / is mounted and looking it up via stat(). Remove /dev/root check from init script. Package-Manager: portage-2.1.2.4 --- sys-apps/hal/ChangeLog | 7 +- sys-apps/hal/Manifest | 34 +++-- sys-apps/hal/files/0.5.9-hald.rc | 18 +-- .../files/0.5.9/16_dev_root_is_mounted.patch | 140 ++++++++++++++++++ sys-apps/hal/files/0.5.9/series | 1 + 5 files changed, 175 insertions(+), 25 deletions(-) create mode 100644 sys-apps/hal/files/0.5.9/16_dev_root_is_mounted.patch diff --git a/sys-apps/hal/ChangeLog b/sys-apps/hal/ChangeLog index e351f798b537..6b146d4249c4 100644 --- a/sys-apps/hal/ChangeLog +++ b/sys-apps/hal/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for sys-apps/hal # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/hal/ChangeLog,v 1.174 2007/04/20 23:22:33 cardoe Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/hal/ChangeLog,v 1.175 2007/04/24 15:42:01 cardoe Exp $ + + 24 Apr 2007; Doug Goldstein files/0.5.9-hald.rc, + +files/0.5.9/16_dev_root_is_mounted.patch, files/0.5.9/series: + Patch from Kay Sievers for assuming / is mounted and looking it up via + stat(). Remove /dev/root check from init script. 20 Apr 2007; Doug Goldstein files/0.5.9-hald.rc, hal-0.5.9.ebuild: diff --git a/sys-apps/hal/Manifest b/sys-apps/hal/Manifest index 28994ffe2631..44fdcd2d0d7a 100644 --- a/sys-apps/hal/Manifest +++ b/sys-apps/hal/Manifest @@ -9,10 +9,10 @@ AUX 0.5.9-hald.conf 364 RMD160 4c54ac942ecc130a585e90d07078372bfc3b5d58 SHA1 ff2 MD5 daa36e163190cfec256b83e348ba012f files/0.5.9-hald.conf 364 RMD160 4c54ac942ecc130a585e90d07078372bfc3b5d58 files/0.5.9-hald.conf 364 SHA256 efc215155f79947827735972eb97a8a460de5084c74811da615292132888d707 files/0.5.9-hald.conf 364 -AUX 0.5.9-hald.rc 1100 RMD160 6188edd7acfa2b0c4c1d9926165ca92da11c9c82 SHA1 c7ee003d0b733cade64233945d61b84750c34aa6 SHA256 dd88b8632367d5149c20020f4b1656edcb2291abdd2a0c94b99881f5e4674bd5 -MD5 9597221d381dd27afc9e3fa9180c6237 files/0.5.9-hald.rc 1100 -RMD160 6188edd7acfa2b0c4c1d9926165ca92da11c9c82 files/0.5.9-hald.rc 1100 -SHA256 dd88b8632367d5149c20020f4b1656edcb2291abdd2a0c94b99881f5e4674bd5 files/0.5.9-hald.rc 1100 +AUX 0.5.9-hald.rc 1108 RMD160 80b17e888d60eb02559aa91b03fe73a165941082 SHA1 6f5284e74abcdf9786c8b8d340d93bbfb0862728 SHA256 7c6857184c856903df02aa52e9db4b8be33ea304652667196ef846ca6f54bb72 +MD5 eacf719e08df60917446c32c5ff33ccc files/0.5.9-hald.rc 1108 +RMD160 80b17e888d60eb02559aa91b03fe73a165941082 files/0.5.9-hald.rc 1108 +SHA256 7c6857184c856903df02aa52e9db4b8be33ea304652667196ef846ca6f54bb72 files/0.5.9-hald.rc 1108 AUX 0.5.9/01_luks_mount_fix.patch 2605 RMD160 00d6b01a0c96123ce6ee66d1762a00988c363139 SHA1 d5b0ce4140b0db59942ef384df640a4749b0c24c SHA256 f1dfdd118055efbc97163273e0f3930f8badf2be3e4f1ca327654c221faa951e MD5 526e8c9b50700bca6340f6a0d73f1aa4 files/0.5.9/01_luks_mount_fix.patch 2605 RMD160 00d6b01a0c96123ce6ee66d1762a00988c363139 files/0.5.9/01_luks_mount_fix.patch 2605 @@ -73,6 +73,10 @@ AUX 0.5.9/15_spec_fdi_matching.patch 7971 RMD160 c47e82e91b4b5ee3b59147356e0f06d MD5 06c14fb64f9c88f18222eb87593c49fe files/0.5.9/15_spec_fdi_matching.patch 7971 RMD160 c47e82e91b4b5ee3b59147356e0f06d65cadd00c files/0.5.9/15_spec_fdi_matching.patch 7971 SHA256 0f5bf01f761260a5af5955ccd6395865316841842edae2451bf8a3acdf4cdb78 files/0.5.9/15_spec_fdi_matching.patch 7971 +AUX 0.5.9/16_dev_root_is_mounted.patch 5417 RMD160 d66edb0a43cb579b548be40f0cdeea0bb305a90e SHA1 0e33f24a71bc91d3568cee6f9d5172db155beb63 SHA256 cd2c580d264e6d22635db3d55249ad5ef733ff0f3e4c0c45d59de643f9196dec +MD5 df7cad356333b0dcefc619df107c7cdb files/0.5.9/16_dev_root_is_mounted.patch 5417 +RMD160 d66edb0a43cb579b548be40f0cdeea0bb305a90e files/0.5.9/16_dev_root_is_mounted.patch 5417 +SHA256 cd2c580d264e6d22635db3d55249ad5ef733ff0f3e4c0c45d59de643f9196dec files/0.5.9/16_dev_root_is_mounted.patch 5417 AUX 0.5.9/95_gentoo_man_page.patch 18159 RMD160 cd4bf6c16e84464b11de755323ef2d0f5c1a54f9 SHA1 f9de30d705eada8e2f631e51b715b9923f732fb4 SHA256 59d81dcb273f3cdc9c7fc9f195331529642fef2c2150b3eeb3fd98ea555b1893 MD5 f6d115e0eb501aba476f4df965bfeb6c files/0.5.9/95_gentoo_man_page.patch 18159 RMD160 cd4bf6c16e84464b11de755323ef2d0f5c1a54f9 files/0.5.9/95_gentoo_man_page.patch 18159 @@ -85,10 +89,10 @@ AUX 0.5.9/97_ignore_fixed_drives.patch 1529 RMD160 42ac279e07a7ef7c30b4dabb67a9e MD5 bbcbdcd6d9bf5db050a0f01fdca08c79 files/0.5.9/97_ignore_fixed_drives.patch 1529 RMD160 42ac279e07a7ef7c30b4dabb67a9edff434d3484 files/0.5.9/97_ignore_fixed_drives.patch 1529 SHA256 81c6882a54abf995df5485e47066c45a34be9b3baa9c6260c21cbb9d091a4220 files/0.5.9/97_ignore_fixed_drives.patch 1529 -AUX 0.5.9/series 589 RMD160 3095591c5772066288413a51e67ac45322608854 SHA1 4c32628e23b240218a7e13deb030c0e2f0a5e4fa SHA256 54c1e8207bf780567f2d14f51b29e3de180a8700d4caef69ec4761c15186ec6b -MD5 310be431c7d74d4610e81d28ff41fe15 files/0.5.9/series 589 -RMD160 3095591c5772066288413a51e67ac45322608854 files/0.5.9/series 589 -SHA256 54c1e8207bf780567f2d14f51b29e3de180a8700d4caef69ec4761c15186ec6b files/0.5.9/series 589 +AUX 0.5.9/series 618 RMD160 6803ff8c3012afd630b2818b346e62f13d1185bc SHA1 04e6d4e538427556a8ddc5e30de19bb5759531c8 SHA256 49ac6c2082a4434e4c40ff4a1002c056216d354274c9b92fcd3810d59d92cc99 +MD5 4b1f23c7daa863998b891f6a299107af files/0.5.9/series 618 +RMD160 6803ff8c3012afd630b2818b346e62f13d1185bc files/0.5.9/series 618 +SHA256 49ac6c2082a4434e4c40ff4a1002c056216d354274c9b92fcd3810d59d92cc99 files/0.5.9/series 618 AUX hal-0.5.7-hald-scripts.patch 8636 RMD160 339765377e3573b382df987903f301860601668f SHA1 c2ffb779f423e07b38f12a852d942928394abc63 SHA256 d0b713f84c7bc782ba7b13f439630a995588097db2141f4a97c110036f64001a MD5 521a06ba0845bd3246d6ed4b589f110f files/hal-0.5.7-hald-scripts.patch 8636 RMD160 339765377e3573b382df987903f301860601668f files/hal-0.5.7-hald-scripts.patch 8636 @@ -191,10 +195,10 @@ EBUILD hal-0.5.9.ebuild 7177 RMD160 cf9131b3eb91be3e90efe501d125a02b18398062 SHA MD5 5bf97425f9c1ebe14d09e69b12078a8e hal-0.5.9.ebuild 7177 RMD160 cf9131b3eb91be3e90efe501d125a02b18398062 hal-0.5.9.ebuild 7177 SHA256 dd9f4b2e4aba2a1dc43bb83f060cc5d13d09291ae861b412b51a75f81534b59c hal-0.5.9.ebuild 7177 -MISC ChangeLog 28677 RMD160 fdcb1cbc044aa0318b4513f7bd6fc2c2f07e7dc7 SHA1 c4c867fc7b5b78cfaeb7bacf39586a1e4f55a317 SHA256 1bfba2979bef79ab964eea1d21b60e708e294255a75731285d9729ebc2a652e8 -MD5 30143900247a321391e5944ccb701834 ChangeLog 28677 -RMD160 fdcb1cbc044aa0318b4513f7bd6fc2c2f07e7dc7 ChangeLog 28677 -SHA256 1bfba2979bef79ab964eea1d21b60e708e294255a75731285d9729ebc2a652e8 ChangeLog 28677 +MISC ChangeLog 28938 RMD160 e6b63f3fcc0ca17e30c8e58375968fdb3a2dcbf2 SHA1 e3f7a491dd89fb5d124c547e4758dd7616686e4b SHA256 d00fd6b9cefbb3cbf15126fbca1e02af0532a0ac6c5c1984ab8b2823a9048c9b +MD5 b6fc1b45f9ab427135c0fac12cdc2b2a ChangeLog 28938 +RMD160 e6b63f3fcc0ca17e30c8e58375968fdb3a2dcbf2 ChangeLog 28938 +SHA256 d00fd6b9cefbb3cbf15126fbca1e02af0532a0ac6c5c1984ab8b2823a9048c9b ChangeLog 28938 MISC metadata.xml 345 RMD160 aa6e810e9546542453ebe5d6ca46804e99f447f2 SHA1 fef829210e8555807f9b69ba5afedffb8af8d02c SHA256 0c9aeabf473a6836c25a5db2ca86b880dec1efa9e52310725e08d1e0df93447d MD5 3317c4000387b670183d305ef9937b75 metadata.xml 345 RMD160 aa6e810e9546542453ebe5d6ca46804e99f447f2 metadata.xml 345 @@ -211,7 +215,7 @@ SHA256 d862b002c9a5547954874b2a0cbadd614381d085e850539e6aef2dd9e9d52dfe files/di -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.3 (GNU/Linux) -iD8DBQFGKUs7oeSe8B0zEfwRAliJAKCICA5LTTQIF4XpRRNewA1nP6ei/wCbBcYP -AnOG+4CRLZieZhkX1KL5g+g= -=Wuif +iD8DBQFGLiVPoeSe8B0zEfwRAmPaAJ0SEQqVgQzGFmQserlm4hIMltFJ1gCfcXSP +WYELSn2S7JGdTeeHxYPE2/s= +=xi59 -----END PGP SIGNATURE----- diff --git a/sys-apps/hal/files/0.5.9-hald.rc b/sys-apps/hal/files/0.5.9-hald.rc index 71aba2b2218c..9d76a1ad737b 100644 --- a/sys-apps/hal/files/0.5.9-hald.rc +++ b/sys-apps/hal/files/0.5.9-hald.rc @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License, v2 or later -# $Header: /var/cvsroot/gentoo-x86/sys-apps/hal/files/0.5.9-hald.rc,v 1.6 2007/04/20 23:22:33 cardoe Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/hal/files/0.5.9-hald.rc,v 1.7 2007/04/24 15:42:01 cardoe Exp $ depend() { need dbus @@ -13,15 +13,15 @@ start() { [ -z "${HALD_VERBOSE}" ] && HALD_VERBOSE="no" ebegin "Starting Hardware Abstraction Layer daemon" - REAL_ROOT=`mount -fv / | cut -d' ' -f1` - TEST_ROOT=`cat /proc/mounts | cut -d' ' -f1 | head -n 2 | tail -n 1` +# REAL_ROOT=`mount -fv / | cut -d' ' -f1` +# TEST_ROOT=`cat /proc/mounts | cut -d' ' -f1 | head -n 2 | tail -n 1` - if [ ! -e ${TEST_ROOT} ]; then - echo "You need a ${TEST_ROOT} that points to your ${REAL_ROOT}" - echo "See http://bugs.gentoo.org/show_bug.cgi?id=175243" - echo "Quick fix is: ln -s ${REAL_ROOT} ${TEST_ROOT}" - eend 2 - fi +# if [ ! -e ${TEST_ROOT} ]; then +# echo "You need a ${TEST_ROOT} that points to your ${REAL_ROOT}" +# echo "See http://bugs.gentoo.org/show_bug.cgi?id=175243" +# echo "Quick fix is: ln -s ${REAL_ROOT} ${TEST_ROOT}" +# eend 2 +# fi if [ -f /proc/acpi/event ]; then chgrp haldaemon /proc/acpi/event diff --git a/sys-apps/hal/files/0.5.9/16_dev_root_is_mounted.patch b/sys-apps/hal/files/0.5.9/16_dev_root_is_mounted.patch new file mode 100644 index 000000000000..873bc294dfe0 --- /dev/null +++ b/sys-apps/hal/files/0.5.9/16_dev_root_is_mounted.patch @@ -0,0 +1,140 @@ +Index: b/hald/linux/blockdev.c +=================================================================== +--- a/hald/linux/blockdev.c 2007-03-07 16:52:19.000000000 -0500 ++++ b/hald/linux/blockdev.c 2007-04-24 11:31:22.000000000 -0400 +@@ -165,9 +165,6 @@ + struct mntent mnt; + struct mntent *mnte; + char buf[1024]; +- unsigned int major; +- unsigned int minor; +- dev_t devt = makedev(0, 0); + GSList *volumes = NULL; + GSList *volume; + +@@ -189,43 +186,53 @@ + /* loop over /proc/mounts */ + while ((mnte = getmntent_r (f, &mnt, buf, sizeof(buf))) != NULL) { + struct stat statbuf; +- gboolean use_device_name_for_match; ++ dev_t devt; + +- /*HAL_INFO ((" * /proc/mounts contain dev %s - type %s", mnt.mnt_fsname, mnt.mnt_type));*/ ++ /* HAL_INFO ((" * /proc/mounts contain dev %s - type %s", mnt.mnt_fsname, mnt.mnt_type)); */ + +- /* If this is a nfs mount (fstype == 'nfs') ignore the mount. Reason: +- * 1. we don't list nfs devices in HAL +- * 2. more problematic: stat on mountpoints with 'stale nfs handle' never come +- * back and block complete HAL and all applications using HAL fail. ++ /* We don't handle nfs mounts in HAL and stat() on mountpoints, ++ * and we would block on 'stale nfs handle'. + */ + if (strcmp(mnt.mnt_type, "nfs") == 0) + continue; + +- use_device_name_for_match = FALSE; +- /* get major:minor of special device file */ +- if (stat (mnt.mnt_fsname, &statbuf) != 0) { +- /* DING DING DING... device node may have been deleted by udev +- * but device is still mounted and we haven't processed the uevent +- * for that deletion from udev.. +- * +- * So in this case... fall back to comparing on device names +- * rather than pretending the device is not mounted as that's +- * what will happen if we just skip this /proc/mounts entry. +- * +- * The reason it's nicer to compare on major:minor is that +- * /proc/mounts is broken - it contains the *device name* +- * passed to mount(2) which in some cases may be a symlink +- * (on many distros it's common to see /proc/mounts contain +- * /dev/root as the device for /). Sigh... +- */ +- use_device_name_for_match = TRUE; +- } else { ++ /* skip plain names, we look for device nodes */ ++ if (mnt.mnt_fsname[0] != '/') ++ continue; ++ ++ /* ++ * We can't just stat() the mountpoint, because it breaks all sorts ++ * non-disk filesystems. So assume, that the names in /proc/mounts ++ * are existing device-files used to mount the filesystem. ++ */ ++ devt = makedev(0, 0); ++ if (stat (mnt.mnt_fsname, &statbuf) == 0) { ++ /* not a device node */ + if (major (statbuf.st_rdev) == 0) + continue; ++ ++ /* found major/minor */ ++ devt = statbuf.st_rdev; ++ } else { ++ /* The root filesystem may be mounted by a device name that doesn't ++ * exist in the real root, like /dev/root, which the kernel uses ++ * internally, when no initramfs image is used. For "/", it is safe ++ * to get the major/minor by stat()'ing the mount-point. ++ */ ++ if (strcmp (mnt.mnt_dir, "/") == 0 && stat ("/", &statbuf) == 0) ++ devt = statbuf.st_dev; ++ ++ /* DING DING DING... the device-node may not exist, or is ++ * already deleted, but the device may be still mounted. ++ * ++ * We will fall back to looking up the device-name, instead ++ * of using major/minor. ++ */ + } + +- /*HAL_INFO (("* found mounts dev %s (%i:%i)", mnt.mnt_fsname, major (statbuf.st_rdev), minor (statbuf.st_rdev)));*/ +- /* match against all hal volumes */ ++ /* HAL_INFO (("* found mounts dev %s (%i:%i)", mnt.mnt_fsname, ++ major (devt), minor (devt))); */ ++ + for (volume = volumes; volume != NULL; volume = g_slist_next (volume)) { + HalDevice *dev; + gboolean is_match; +@@ -233,7 +240,8 @@ + is_match = FALSE; + dev = HAL_DEVICE (volume->data); + +- if (use_device_name_for_match) { ++ /* lookup dev_t or devname of known hal devices */ ++ if (major (devt) == 0) { + const char *device_name; + + device_name = hal_device_property_get_string (dev, "block.device"); +@@ -243,14 +251,16 @@ + if (strcmp (device_name, mnt.mnt_fsname) == 0) + is_match = TRUE; + } else { +- major = hal_device_property_get_int (dev, "block.major"); +- if (major == 0) ++ unsigned int majornum; ++ unsigned int minornum; ++ ++ majornum = hal_device_property_get_int (dev, "block.major"); ++ if (majornum == 0) + continue; +- minor = hal_device_property_get_int (dev, "block.minor"); +- devt = makedev (major, minor); +- /*HAL_INFO ((" match %s (%i:%i)", hal_device_get_udi (dev), major, minor));*/ ++ minornum = hal_device_property_get_int (dev, "block.minor"); ++ /* HAL_INFO ((" match %s (%i:%i)", hal_device_get_udi (dev), majornum, minornum)); */ + +- if (statbuf.st_rdev == devt) ++ if (majornum == major (devt) && minornum == minor (devt)) + is_match = TRUE; + } + +@@ -262,9 +272,8 @@ + hasmntopt (&mnt, MNTOPT_RO) ? TRUE : FALSE); + hal_device_property_set_string (dev, "volume.mount_point", mnt.mnt_dir); + device_property_atomic_update_end (); +- /*HAL_INFO ((" set %s to be mounted at %s (%s)", +- hal_device_get_udi (dev), mnt.mnt_dir, +- hasmntopt (&mnt, MNTOPT_RO) ? "ro" : "rw"));*/ ++ /* HAL_INFO ((" set %s to be mounted at %s (%s)", hal_device_get_udi (dev), ++ mnt.mnt_dir, hasmntopt (&mnt, MNTOPT_RO) ? "ro" : "rw")); */ + volumes = g_slist_delete_link (volumes, volume); + break; + } diff --git a/sys-apps/hal/files/0.5.9/series b/sys-apps/hal/files/0.5.9/series index 1bf2930f2b22..520c267a9ee2 100644 --- a/sys-apps/hal/files/0.5.9/series +++ b/sys-apps/hal/files/0.5.9/series @@ -13,6 +13,7 @@ 13_detect_newer_macbooks.patch 14_ntfs_allows_utf8.patch 15_spec_fdi_matching.patch +16_dev_root_is_mounted.patch 95_gentoo_man_page.patch 96_plugdev_allow_send.patch 97_ignore_fixed_drives.patch -- 2.26.2