|
|
681352 |
From 298cfc4743b9cca6cc0c685b9fce5b34827bec1b Mon Sep 17 00:00:00 2001
|
|
|
681352 |
From: Pavel Raiskup <praiskup@redhat.com>
|
|
|
681352 |
Date: Thu, 4 Jan 2018 18:21:27 +0100
|
|
|
681352 |
Subject: [PATCH] tests: fix race in dirrem01 and dirrem02
|
|
|
681352 |
|
|
|
681352 |
Proposal:
|
|
|
681352 |
https://www.mail-archive.com/bug-tar@gnu.org/msg05451.html
|
|
|
681352 |
|
|
|
681352 |
Previously the '--checkpoint-action=echo' was triggered after
|
|
|
681352 |
'--checkpoint-action=sleep=1' - so the order of events *usually*
|
|
|
681352 |
was (for --format='gnu'):
|
|
|
681352 |
|
|
|
681352 |
...
|
|
|
681352 |
1. checkpoint handler before write of 'dir/sub' member
|
|
|
681352 |
2. one-second delay
|
|
|
681352 |
3. stderr write: 'tar: Write checkpoint 3'
|
|
|
681352 |
4. write the member 'dir/sub' into the archive
|
|
|
681352 |
5. check that the member's ctime has not been changed
|
|
|
681352 |
6. genfile's detecting 'Write checkpoint', doing unlink
|
|
|
681352 |
...
|
|
|
681352 |
|
|
|
681352 |
But sometimes, the genfile was fast enough to win the race and
|
|
|
681352 |
unlinked the directory before the member was written into the
|
|
|
681352 |
archive (IOW, the order was 1-2-3-6-4-5). This led to the
|
|
|
681352 |
occasional warning 'tar: dir/sub: file changed as we read it'.
|
|
|
681352 |
|
|
|
681352 |
Swap the order of 'sleep=1' and 'echo' actions so the genfile
|
|
|
681352 |
utility has (hopefully) enough time to do the unlink before
|
|
|
681352 |
writing the file into the archive (enforce 1-2-3-6-4-5 order).
|
|
|
681352 |
|
|
|
681352 |
* tests/dirrem01.at: Swap 'sleep=1' and 'echo' actions.
|
|
|
681352 |
* tests/dirrem02.at: Likewise.
|
|
|
681352 |
---
|
|
|
681352 |
tests/dirrem01.at | 5 +++--
|
|
|
681352 |
tests/dirrem02.at | 7 ++++---
|
|
|
681352 |
2 files changed, 7 insertions(+), 5 deletions(-)
|
|
|
681352 |
|
|
|
681352 |
diff --git a/tests/dirrem01.at b/tests/dirrem01.at
|
|
|
681352 |
index 40344dc..dabc206 100644
|
|
|
681352 |
--- a/tests/dirrem01.at
|
|
|
681352 |
+++ b/tests/dirrem01.at
|
|
|
681352 |
@@ -47,14 +47,15 @@ gnu) CPT=3;;
|
|
|
681352 |
esac
|
|
|
681352 |
|
|
|
681352 |
genfile --run --checkpoint=$CPT --unlink dir/sub/file2 --unlink dir/sub -- \
|
|
|
681352 |
- tar --blocking-factor=1 --checkpoint=1 --checkpoint-action='sleep=1' \
|
|
|
681352 |
- --checkpoint-action='echo' -c -f archive.tar \
|
|
|
681352 |
+ tar --blocking-factor=1 --checkpoint=1 --checkpoint-action='echo' \
|
|
|
681352 |
+ --checkpoint-action='sleep=1' -c -f archive.tar \
|
|
|
681352 |
--listed-incremental db -v dir >/dev/null
|
|
|
681352 |
],
|
|
|
681352 |
[1],
|
|
|
681352 |
[ignore],
|
|
|
681352 |
[tar: dir: Directory is new
|
|
|
681352 |
tar: dir/sub: Directory is new
|
|
|
681352 |
+tar: dir/sub: file changed as we read it
|
|
|
681352 |
tar: dir/sub: File removed before we read it
|
|
|
681352 |
],[],[],[gnu,posix])
|
|
|
681352 |
|
|
|
681352 |
diff --git a/tests/dirrem02.at b/tests/dirrem02.at
|
|
|
681352 |
index e1cf9ef..924454f 100644
|
|
|
681352 |
--- a/tests/dirrem02.at
|
|
|
681352 |
+++ b/tests/dirrem02.at
|
|
|
681352 |
@@ -20,7 +20,7 @@
|
|
|
681352 |
|
|
|
681352 |
# Description:
|
|
|
681352 |
#
|
|
|
681352 |
-# When an explicitley named directory disappears during creation
|
|
|
681352 |
+# When an explicitly named directory disappears during creation
|
|
|
681352 |
# of incremental dump, tar should still exit with TAREXIT_FAILURE (2).
|
|
|
681352 |
#
|
|
|
681352 |
# For further details see dirrem01.at
|
|
|
681352 |
@@ -44,14 +44,15 @@ gnu) CPT=3;;
|
|
|
681352 |
esac
|
|
|
681352 |
|
|
|
681352 |
genfile --run --checkpoint=$CPT --unlink dir/sub/file2 --unlink dir/sub -- \
|
|
|
681352 |
- tar --blocking-factor=1 --checkpoint=1 --checkpoint-action='sleep=1' \
|
|
|
681352 |
- --checkpoint-action='echo' -c -f archive.tar \
|
|
|
681352 |
+ tar --blocking-factor=1 --checkpoint=1 --checkpoint-action='echo' \
|
|
|
681352 |
+ --checkpoint-action='sleep=1' -c -f archive.tar \
|
|
|
681352 |
--listed-incremental db -v dir dir/sub >/dev/null
|
|
|
681352 |
],
|
|
|
681352 |
[2],
|
|
|
681352 |
[ignore],
|
|
|
681352 |
[tar: dir: Directory is new
|
|
|
681352 |
tar: dir/sub: Directory is new
|
|
|
681352 |
+tar: dir/sub: file changed as we read it
|
|
|
681352 |
tar: dir/sub: Cannot open: No such file or directory
|
|
|
681352 |
tar: Exiting with failure status due to previous errors
|
|
|
681352 |
],[],[],[gnu,posix])
|
|
|
681352 |
--
|
|
|
681352 |
2.14.3
|
|
|
681352 |
|