]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: (lsfd) refine the pattern for comparing the output of the commands
authorMasatake YAMATO <yamato@redhat.com>
Fri, 4 Feb 2022 17:18:14 +0000 (02:18 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Fri, 4 Feb 2022 17:20:46 +0000 (02:20 +0900)
When comparing the output of lsfd and findmnt commands, I passed just
"$MNTID" to grep for filtering the output of findmnt. It was too relaxed.

It should be "$MNTID\b"; a space after $MNTID was needed.

https://github.com/util-linux/util-linux/issues/1511#issuecomment-1029968595
shows the output triggering the bug of the test case.

Reported-by: Chris Hofstaedtler <zeha@debian.org>
Reported-by: Anatoly Pugachev <matorola@gmail.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
tests/ts/lsfd/lsfd-functions.bash

index 05ae3e8f754c911bf5d134aab95866cb64e1b95e..c46dc06301675c2315581479be28dccfcd8b8584 100644 (file)
@@ -41,7 +41,7 @@ function lsfd_compare_dev {
     # for a given device separately.
     # We can save the code for extracting the major part and minor part
     # if we use findmnt.
-    local FINDMNT_MNTID_DEV=$("${FINDMNT}" --raw -n -o ID,MAJ:MIN | grep "^${MNTID}")
+    local FINDMNT_MNTID_DEV=$("${FINDMNT}" --raw -n -o ID,MAJ:MIN | grep "^${MNTID}\b")
     echo 'FINDMNT[RUN]:' $?
     if [ "${MNTID} ${DEV}" == "${FINDMNT_MNTID_DEV}" ]; then
        echo 'DEV[STR]:' 0