From: Amir Goldstein <amir73il@gmail.com>
To: Zorro Lang <zlang@redhat.com>
Cc: Alexander Larsson <alexl@redhat.com>,
Miklos Szeredi <miklos@szeredi.hu>,
linux-unionfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH v2 4/4] overlay: test parsing of lowerdir+,datadir+ mount options
Date: Mon, 4 Dec 2023 20:58:59 +0200 [thread overview]
Message-ID: <20231204185859.3731975-5-amir73il@gmail.com> (raw)
In-Reply-To: <20231204185859.3731975-1-amir73il@gmail.com>
Fork test overlay/083 to test parsing of lowerdir+,datadir+ mount options.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
tests/overlay/086 | 81 +++++++++++++++++++++++++++++++++++++++++++
tests/overlay/086.out | 2 ++
2 files changed, 83 insertions(+)
create mode 100755 tests/overlay/086
create mode 100644 tests/overlay/086.out
diff --git a/tests/overlay/086 b/tests/overlay/086
new file mode 100755
index 00000000..b5960517
--- /dev/null
+++ b/tests/overlay/086
@@ -0,0 +1,81 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2023 CTERA Networks. All Rights Reserved.
+#
+# FS QA Test 086
+#
+# Test lowerdir+,datadir+ mount option restrictions.
+#
+
+. ./common/preamble
+_begin_fstest auto quick mount
+
+# Import common functions.
+. ./common/filter
+
+# real QA test starts here
+_supported_fs overlay
+
+# _overlay_check_* helpers do not handle special chars well
+_require_scratch_nocheck
+_require_scratch_overlay_lowerdir_add_layers
+
+# Remove all files from previous tests
+_scratch_mkfs
+
+# Create lowerdirs with special characters
+lowerdir_spaces="$OVL_BASE_SCRATCH_MNT/lower1 with spaces"
+lowerdir_colons="$OVL_BASE_SCRATCH_MNT/lower2:with::colons"
+lowerdir_colons_esc="$OVL_BASE_SCRATCH_MNT/lower2\:with\:\:colons"
+lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
+upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
+workdir=$OVL_BASE_SCRATCH_MNT/$OVL_WORK
+mkdir -p "$lowerdir_spaces" "$lowerdir_colons"
+
+# _overlay_mount_* helpers do not handle lowerdir+,datadir+, so execute mount directly.
+
+# check illegal combinations and order of lowerdir,lowerdir+,datadir+
+$MOUNT_PROG -t overlay none $SCRATCH_MNT \
+ -o"lowerdir=$lowerdir,lowerdir+=$lowerdir_colons" \
+ 2>> $seqres.full && \
+ echo "ERROR: invalid combination of lowerdir and lowerdir+ mount options"
+
+$UMOUNT_PROG $SCRATCH_MNT 2>/dev/null
+
+$MOUNT_PROG -t overlay none $SCRATCH_MNT \
+ -o"lowerdir=$lowerdir,datadir+=$lowerdir_colons" \
+ -o redirect_dir=follow,metacopy=on 2>> $seqres.full && \
+ echo "ERROR: invalid combination of lowerdir and datadir+ mount options"
+
+$UMOUNT_PROG $SCRATCH_MNT 2>/dev/null
+
+$MOUNT_PROG -t overlay none $SCRATCH_MNT \
+ -o"datadir+=$lowerdir,lowerdir+=$lowerdir_colons" \
+ -o redirect_dir=follow,metacopy=on 2>> $seqres.full && \
+ echo "ERROR: invalid order of lowerdir+ and datadir+ mount options"
+
+$UMOUNT_PROG $SCRATCH_MNT 2>/dev/null
+
+# mount is expected to fail with escaped colons.
+$MOUNT_PROG -t overlay none $SCRATCH_MNT \
+ -o"lowerdir+=$lowerdir_colons_esc" \
+ 2>> $seqres.full && \
+ echo "ERROR: incorrect parsing of escaped colons in lowerdir+ mount option"
+
+$UMOUNT_PROG $SCRATCH_MNT 2>/dev/null
+
+# mount is expected to succeed without escaped colons.
+$MOUNT_PROG -t overlay ovl_esc_test $SCRATCH_MNT \
+ -o"lowerdir+=$lowerdir_colons,datadir+=$lowerdir_spaces" \
+ -o redirect_dir=follow,metacopy=on \
+ 2>&1 | tee -a $seqres.full
+
+# 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 -q 'datadir+'.*spaces || \
+ echo "ERROR: escaped spaces truncated from datadir+ mount option"
+
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/overlay/086.out b/tests/overlay/086.out
new file mode 100644
index 00000000..b34758fd
--- /dev/null
+++ b/tests/overlay/086.out
@@ -0,0 +1,2 @@
+QA output created by 086
+Silence is golden
--
2.34.1
next prev parent reply other threads:[~2023-12-04 18:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 18:58 [PATCH v2 0/4] Overlayfs tests for 6.7-rc1 Amir Goldstein
2023-12-04 18:58 ` [PATCH v2 1/4] overlay: Add tests for nesting private xattrs Amir Goldstein
2023-12-10 13:35 ` Zorro Lang
2023-12-10 15:28 ` Amir Goldstein
2023-12-10 20:45 ` Zorro Lang
2023-12-11 6:47 ` Amir Goldstein
2023-12-04 18:58 ` [PATCH v2 2/4] overlay: prepare for new lowerdir+,datadir+ tests Amir Goldstein
2023-12-06 8:37 ` Zorro Lang
2023-12-06 10:29 ` Amir Goldstein
2023-12-06 13:35 ` Zorro Lang
2023-12-04 18:58 ` [PATCH v2 3/4] overlay: test data-only lowerdirs with datadir+ mount option Amir Goldstein
2023-12-04 18:58 ` Amir Goldstein [this message]
2023-12-09 4:49 ` [PATCH v2 0/4] Overlayfs tests for 6.7-rc1 Zorro Lang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231204185859.3731975-5-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=alexl@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=zlang@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox