summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-10-09 21:42:40 +0200
committerDave Reisner <dreisner@archlinux.org>2011-10-09 23:48:33 +0200
commit1d86ae6e5b8976aade3de34990d289fdd3806032 (patch)
tree596d461145a70e49bc621ed6956c3d1530d0cc2a
parent11df4eee155ed5e133fc30b4d272955942f51f73 (diff)
downloadmkinitcpio-1d86ae6e5b8976aade3de34990d289fdd3806032.tar.gz
mkinitcpio-1d86ae6e5b8976aade3de34990d289fdd3806032.tar.xz
mkinitcpio: avoid using mountpoint
As it turns out, the mountpoint toy from util-linux isn't really at feature parity with sysvinit's. In particular, and with respect to v2.20: - It throws false negatives when /proc isn't mounted. Rather, it should fall back on using stat(2), as is the basis for sysvinit's tool. - when /proc is mounted with as source of 'none', it segfaults on a null dereference. Patches have been sent upstream to resolve these issues, but in the meantime, we're mounting /dev and /proc for very specific reasons. Instead of relying on a fork/exec to figure out if these API FS's are mounted, use a simple bash test to see if these specific needs are available within the FS. One of many possible fixes for FS#26344. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rwxr-xr-xmkinitcpio6
1 files changed, 4 insertions, 2 deletions
diff --git a/mkinitcpio b/mkinitcpio
index 37db805..d0ae08c 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -157,8 +157,10 @@ fi
readonly NC BOLD BLUE GREEN RED YELLOW
# insist that /proc and /dev be mounted (important for chroots)
-mountpoint -q /proc || die "/proc must be mounted!"
-mountpoint -q /dev || die "/dev must be mounted!"
+# NOTE: avoid using mountpoint for this -- look for the paths that we actually
+# use in mkinitcpio. Avoids issues like FS#26344.
+[[ -e /proc/self/mountinfo ]] || die "/proc must be mounted!"
+[[ -e /dev/fd ]] || die "/dev must be mounted!"
if [[ $BASEDIR ]]; then
# resolve the path. it might be a relative path and/or contain symlinks