public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers3@gmail.com>
To: fstests@vger.kernel.org
Cc: Eric Biggers <ebiggers@google.com>
Subject: [PATCH] generic/062: don't assume same readdir order after re-creating directory
Date: Mon, 12 Dec 2016 22:57:01 -0800	[thread overview]
Message-ID: <1481612221-65504-1-git-send-email-ebiggers3@gmail.com> (raw)

From: Eric Biggers <ebiggers@google.com>

generic/062 uses getfattr to dump xattrs for a directory tree, then
deletes and recreates that directory tree, then dumps the xattrs again
and compares the dump to the original.  This was failing when run on
ext4 with encryption enabled because getfattr's output is in readdir
order, but ext4 encryption by design chooses unpredictable encrypted
filenames for each new directory, causing the readdir order to change
after backup and restore.  It is not really a valid assumption that the
readdir order will always be the same, so update the test to sort the
filenames, removing this assumption.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 tests/generic/062 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/generic/062 b/tests/generic/062
index e4dc2cc..643f02c 100755
--- a/tests/generic/062
+++ b/tests/generic/062
@@ -178,8 +178,11 @@ echo; echo
 
 _backup()
 {
-	# NB: no filtering of scratch here... (need to restore too)
-	$GETFATTR_PROG --absolute-names -dh -R -m '.' $SCRATCH_MNT >$1
+	# Note: we don't filter scratch here since we need to restore too.  But
+	# we *do* sort the output by path, since it otherwise would depend on
+	# readdir order, which on some filesystems may change after re-creating
+	# the files.
+	$GETFATTR_PROG --absolute-names -dh -R -m '.' $SCRATCH_MNT | _sort_getfattr_output >$1
 	echo BACKUP $1 >>$seqres.full
 	cat $1 >> $seqres.full
 	[ ! -s $1 ] && echo "warning: $1 (backup file) is empty"
-- 
2.8.0.rc3.226.g39d4020


             reply	other threads:[~2016-12-13  6:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-13  6:57 Eric Biggers [this message]
2016-12-16 14:22 ` [PATCH] generic/062: don't assume same readdir order after re-creating directory Brian Foster

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=1481612221-65504-1-git-send-email-ebiggers3@gmail.com \
    --to=ebiggers3@gmail.com \
    --cc=ebiggers@google.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