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