All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v4, 1/2] lib/tst_test.sh: Make tst_umount work with argument has trailing slash
@ 2021-07-19  9:21 Leo Liang
  2021-07-21 14:21 ` Petr Vorel
  0 siblings, 1 reply; 2+ messages in thread
From: Leo Liang @ 2021-07-19  9:21 UTC (permalink / raw)
  To: ltp

/proc/mounts shows the mount point without trailing slashes, e.g.
~ $ cat /proc/mounts
xxx /root/cgroup cgroup rw,relatime,cpu 0 0

So current tst_umount would not work with argument that has trailing slash, e.g.
tst_umount cgroup/ would give "The device is not mounted".

Fix this by filtering out the trailing slash in the argument for grep.

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
---
 testcases/lib/tst_test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index c6aa2c487..cbdfb707a 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -282,7 +282,7 @@ tst_umount()
 
 	[ -z "$device" ] && return
 
-	if ! grep -q "$device" /proc/mounts; then
+	if ! grep -q "${device%/}" /proc/mounts; then
 		tst_res TINFO "The $device is not mounted, skipping umount"
 		return
 	fi
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [LTP] [PATCH v4, 1/2] lib/tst_test.sh: Make tst_umount work with argument has trailing slash
  2021-07-19  9:21 [LTP] [PATCH v4, 1/2] lib/tst_test.sh: Make tst_umount work with argument has trailing slash Leo Liang
@ 2021-07-21 14:21 ` Petr Vorel
  0 siblings, 0 replies; 2+ messages in thread
From: Petr Vorel @ 2021-07-21 14:21 UTC (permalink / raw)
  To: ltp

Hi Leo,

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-21 14:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-19  9:21 [LTP] [PATCH v4, 1/2] lib/tst_test.sh: Make tst_umount work with argument has trailing slash Leo Liang
2021-07-21 14:21 ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.