Skip to contentSkip to conversation

tests: search mount point in canonicalized form in /proc/mounts

PATCH Applied Bernhard Voelker 2 participants 2 messages Jul 27, 2012 – Jul 30, 2012 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: search mount point in canonicalized form in /proc/mounts

Quoted 2 lines

From 9fe90eaa1c1d425437eab705a29e7c7800ffa7fe Mon Sep 17 00:00:00 2001

From: Bernhard Voelker <[email protected]>
Date: Fri, 27 Jul 2012 10:35:01 +0200
Subject: [PATCH] tests: search mount point in canonicalized form in
/proc/mounts

* tests/functions.sh (ts_is_mounted): Enhance to resolve symlinks in given mount point before grep'ing in /proc/mount.

If the test directory is on a symlink, then e.g. tests/ts/cramfs/doubles failed because the kernel keeps the mount entry in a canonicalized form in /proc/mounts while this function searched for it with the original path name.

---
 tests/functions.sh |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
tests/functions.sh +4 -1
index 74cde97..a3bb482 100644
@@ -377,7 +377,10 @@ function ts_device_has_uuid {
 }
 
 function ts_is_mounted {
-	local DEV=$1
+	local DEV=$( readlink -f $1 )
+	if [ ".$DEV" = '.' ]; then
+	  DEV=$1
+	fi
 
 	grep -q $DEV /proc/mounts && return 0
 
Signature · 1 line
1.7.7
maintainer Applied
#1 lore raw
Quoted 2 lines · Bernhard Voelker
 tests/functions.sh |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com