public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Omer Zilberberg <omzg@plexistor.com>
To: fstests@vger.kernel.org
Cc: Omer Zilberberg <omzg@plexistor.com>
Subject: [PATCH] generic/074: _cleanup potentially removes local FS files
Date: Sun, 29 Jan 2017 15:56:20 +0200	[thread overview]
Message-ID: <20170129135620.25464-1-omzg@plexistor.com> (raw)

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>
---
 tests/generic/074 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/generic/074 b/tests/generic/074
index 55264bd..ef84263 100755
--- a/tests/generic/074
+++ b/tests/generic/074
@@ -33,7 +33,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _cleanup()
 {
-    rm -rf $fstest_dir.* $tmp.*
+    [ -n "$fstest_dir" ] && rm -rf $fstest_dir.*
+    rm -rf $tmp.*
 }
 
 # get standard environment, filters and checks
-- 
2.9.3


             reply	other threads:[~2017-01-29 13:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-29 13:56 Omer Zilberberg [this message]
2017-02-04  4:18 ` [PATCH] generic/074: _cleanup potentially removes local FS files Eryu Guan
2017-02-05  6:45   ` Omer Zilberberg

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=20170129135620.25464-1-omzg@plexistor.com \
    --to=omzg@plexistor.com \
    --cc=fstests@vger.kernel.org \
    /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