[PATCH] overlay: add test for lowerdir mount option parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check parsing and display of spaces and escaped colons and commans in
lowerdir mount option.

This is a regression test for two bugs introduced in v6.5 with the
conversion to new mount api.

Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
---

Zorro,

This is a test for two regressions in kernel v6.5.
The two fixes were merged in 6.6-rc6 and have been picked for
the upcoming LTS 6.5.y release.

Thanks,
Amir.

 tests/overlay/083     | 54 +++++++++++++++++++++++++++++++++++++++++++
 tests/overlay/083.out |  2 ++
 2 files changed, 56 insertions(+)
 create mode 100755 tests/overlay/083
 create mode 100644 tests/overlay/083.out

diff --git a/tests/overlay/083 b/tests/overlay/083
new file mode 100755
index 00000000..071b4b84
--- /dev/null
+++ b/tests/overlay/083
@@ -0,0 +1,54 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2023 CTERA Networks. All Rights Reserved.
+#
+# FS QA Test 083
+#
+# Test regressions in parsing and display of special chars in mount options.
+#
+# The following kernel commits from v6.5 introduced regressions:
+#  b36a5780cb44 ("ovl: modify layer parameter parsing")
+#  1784fbc2ed9c ("ovl: port to new mount api")
+#
+
+. ./common/preamble
+_begin_fstest auto quick mount
+
+# Import common functions.
+. ./common/filter
+
+# real QA test starts here
+_supported_fs overlay
+_fixed_by_kernel_commit 32db51070850 \
+	"ovl: fix regression in showing lowerdir mount option"
+_fixed_by_kernel_commit c34706acf40b \
+	"ovl: fix regression in parsing of mount options with escaped comma"
+
+# _overlay_check_* helpers do not handle special chars well
+_require_scratch_nocheck
+
+# Remove all files from previous tests
+_scratch_mkfs
+
+# Create lowerdirs with special characters
+lowerdir1="$OVL_BASE_SCRATCH_MNT/lower1 with  spaces"
+lowerdir2="$OVL_BASE_SCRATCH_MNT/lower2:with::colons"
+lowerdir3="$OVL_BASE_SCRATCH_MNT/lower3,with,,commas"
+lowerdir2_esc="$OVL_BASE_SCRATCH_MNT/lower2\:with\:\:colons"
+lowerdir3_esc="$OVL_BASE_SCRATCH_MNT/lower3\,with\,\,commas"
+upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
+workdir=$OVL_BASE_SCRATCH_MNT/$OVL_WORK
+mkdir -p "$lowerdir1" "$lowerdir2" "$lowerdir3"
+
+# _overlay_mount_* helpers do not handle special chars well, so execute mount directly.
+# if escaped colons and commas are not parsed correctly, mount will fail.
+$MOUNT_PROG -t overlay ovl_esc_test $SCRATCH_MNT \
+	-o"upperdir=$upperdir,workdir=$workdir,lowerdir=$lowerdir3_esc:$lowerdir2_esc:$lowerdir1"
+
+# if spaces are not escaped when showing mount options,
+# mount command will not show the word 'spaces' after the spaces
+$MOUNT_PROG -t overlay | grep ovl_esc_test  | tee -a $seqres.full | grep -v spaces
+
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/overlay/083.out b/tests/overlay/083.out
new file mode 100644
index 00000000..0beba309
--- /dev/null
+++ b/tests/overlay/083.out
@@ -0,0 +1,2 @@
+QA output created by 083
+Silence is golden
-- 
2.34.1




[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux