]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
generic/074: _cleanup potentially removes local FS files
authorOmer Zilberberg <omzg@plexistor.com>
Sun, 5 Feb 2017 06:58:20 +0000 (08:58 +0200)
committerEryu Guan <eguan@redhat.com>
Mon, 6 Feb 2017 03:48:28 +0000 (11:48 +0800)
fstest_dir is set after _cleanup() is defined and _require_test is
called. If _require_test fails (due to some unrelated bug in tested
FS), _cleanup will attempt to remove $fstest_dir.*, which expands to
.* This has the unfortunate effect of removing xfstests' .git and
.gitignore.

Here is the 074.out.bad file for this case:
QA output created by 074
mount: permission denied
common/rc: retrying test device mount with external set
mount: permission denied
common/rc: could not mount /dev/pmem0 on /mnt
rm: refusing to remove '.' or '..' directory: skipping '.'
rm: refusing to remove '.' or '..' directory: skipping '..'
----

The only other test which could face the same problem is
generic/285.  However, that test defines _cleanup after the
_require* calls, and so on _require_test failure, 285.out.bad
contains the harmless:
./common/rc: line 1: _cleanup: command not found

Signed-off-by: Omer Zilberberg <omzg@plexistor.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
tests/generic/074

index 55264bde278ed71a85359047c59cbb4bbd5aa89a..737b49bf64f0560473f02b02430ce1321513d792 100755 (executable)
@@ -28,6 +28,7 @@ echo "QA output created by $seq"
 
 here=`pwd`
 tmp=/tmp/$$
+fstest_dir=$TEST_DIR/fstest
 status=0       # success is the default!
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
@@ -45,7 +46,6 @@ _supported_os IRIX Linux
 _require_test
 
 rm -f $seqres.full
-fstest_dir=$TEST_DIR/fstest
 
 _do_test()
 {