From ec182d8b9da7596809aab9aab4fc931e9ccb7494 Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Fri, 9 Mar 2018 18:27:44 +0100 Subject: tests: fix grep expressions for devices ts_is_mounted "/dev/loop1" returned true if /dev/loop17 was mounted. A very annoying source of sporadic failures since many years. This issue became more visible since running the checks in parallel, which increases the probability to get bigger loop device numbers. Signed-off-by: Ruediger Meier --- tests/functions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/functions.sh') diff --git a/tests/functions.sh b/tests/functions.sh index fc8f86377..66eaa9d6e 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -618,10 +618,10 @@ function ts_mount { function ts_is_mounted { local DEV=$(ts_canonicalize "$1") - grep -q $DEV /proc/mounts && return 0 + grep -q "\(^\| \)$DEV " /proc/mounts && return 0 if [ "${DEV#/dev/loop/}" != "$DEV" ]; then - grep -q "/dev/loop${DEV#/dev/loop/}" /proc/mounts && return 0 + grep -q "^/dev/loop${DEV#/dev/loop/} " /proc/mounts && return 0 fi return 1 } -- cgit v1.2.3-55-g7522