From e97ec6ffb7aeeaf7d3faa29691aa613c94c71a22 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 28 Dec 2023 14:20:11 +0100 Subject: [PATCH] shadow_copy: Add test for missing directory in "current" fileset Right now we can't traverse a subdirectory in a snapshot which was deleted in the current set of files. Bug: https://bugzilla.samba.org/show_bug.cgi?id=15544 Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison (cherry picked from commit a0bfadb32b83ab1e58290f84c298d345e21866d9) --- selftest/knownfail.d/shadow_copy2 | 1 + source3/script/tests/test_shadow_copy.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 selftest/knownfail.d/shadow_copy2 diff --git a/selftest/knownfail.d/shadow_copy2 b/selftest/knownfail.d/shadow_copy2 new file mode 100644 index 00000000000..cb53e558fd8 --- /dev/null +++ b/selftest/knownfail.d/shadow_copy2 @@ -0,0 +1 @@ +^samba3.blackbox.shadow_copy2.*.fetch\ a\ file\ without\ a\ latest\ version.* \ No newline at end of file diff --git a/source3/script/tests/test_shadow_copy.sh b/source3/script/tests/test_shadow_copy.sh index b5726e4b833..3141df3568d 100755 --- a/source3/script/tests/test_shadow_copy.sh +++ b/source3/script/tests/test_shadow_copy.sh @@ -389,6 +389,32 @@ test_shadow_copy_format() failed=`expr $failed + 1` } +# Test fetching a file where there's no current version of it +test_missing_basedir() +{ + local share + local where + local prefix + local snapidx + + share=$1 + where=$2 + prefix=$3 + snapidx=$4 + + #delete snapshots from previous tests + find $WORKDIR -name ".snapshots" -exec rm -rf {} \; 1>/dev/null 2>&1 + build_snapshots $WORKDIR/$where "$prefix" "$snapidx" "$snapidx" + + (cd "$WORKDIR/$where"/share; mv bar _bar) + + testit "fetch a file without a latest version" \ + test_fetch_snap_file "$share" "bar/baz" "$snapidx" || \ + failed=`expr $failed + 1` + + (cd "$WORKDIR/$where"/share; mv _bar bar) +} + #build "latest" files build_files $WORKDIR/mount base/share "latest" "latest" @@ -423,5 +449,6 @@ test_shadow_copy_format shadow_fmt2 mount/base share 2 "shadow:format with some test_shadow_copy_format shadow_fmt3 mount/base share 2 "shadow:format with modified format" test_shadow_copy_format shadow_fmt4 mount/base share 3 "shadow:format with snapprefix" test_shadow_copy_format shadow_fmt5 mount/base share 6 "shadow:format with delimiter" +test_missing_basedir shadow3 "mount/base" "share" 6 exit $failed -- 2.11.4.GIT