All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-ext4@vger.kernel.org, Darren Hart <dvhart@linux.intel.com>,
	Richard Purdie <richard.purdie@linuxfoundation.org>
Subject: Re: [PATCH 9/9] libext2fs: sort keys for xattr blocks
Date: Sat, 5 Mar 2016 22:55:14 -0500	[thread overview]
Message-ID: <20160306035514.GH10297@thunk.org> (raw)
In-Reply-To: <20160213223824.25381.8002.stgit@birch.djwong.org>

On Sat, Feb 13, 2016 at 02:38:24PM -0800, Darrick J. Wong wrote:
> Richard Purdie reports that libext2fs doesn't sort attribute keys in
> the xattr block correctly, causing the kernel to return -ENODATA when
> querying attributes that should be there.  Therefore, sort attributes
> so that whatever ends up in the xattr block is sorted according to
> what the kernel expects.
> 
> Cc: Darren Hart <dvhart@linux.intel.com>
> Reported-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Applied, with one minor change.  You should never use something like
/tmp/b in a test script becuase it's possible that /tmp/b might
already exist, and might be not even owned by the user.  (In my case
/tmp/b was a root owned file that was sufficiently big that it it
caused ea_set command to fail with a "out of space" error.)

If /tmp/b was writable by the user and was something previous, then
the developer might get after the test script executes "rm -rf /tmp/b".

						- Ted

diff --git a/tests/d_xattr_sorting/script b/tests/d_xattr_sorting/script
index 30c189a..30187f1 100644
--- a/tests/d_xattr_sorting/script
+++ b/tests/d_xattr_sorting/script
@@ -17,16 +17,18 @@ $MKE2FS -Fq $TMPFILE 512 > /dev/null 2>&1
 status=$?
 echo Exit status is $status >> $OUT
 
-perl -e 'print "x" x 256;' > /tmp/b
+B=$(mktemp ${TMPDIR:-/tmp}/b.XXXXXX)
+
+perl -e 'print "x" x 256;' > $B
 
 echo "ea_set / security.SMEG64 -f /tmp/b" > $OUT.new
-$DEBUGFS -w -R "ea_set / security.SMEG64 -f /tmp/b" $TMPFILE >> $OUT.new 2>&1
+$DEBUGFS -w -R "ea_set / security.SMEG64 -f $B" $TMPFILE >> $OUT.new 2>&1
 status=$?
 echo Exit status is $status >> $OUT.new
 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
 
 echo "ea_set / security.imb -f /tmp/b" > $OUT.new
-$DEBUGFS -w -R "ea_set / security.imb -f /tmp/b" $TMPFILE >> $OUT.new 2>&1
+$DEBUGFS -w -R "ea_set / security.imb -f $B" $TMPFILE >> $OUT.new 2>&1
 status=$?
 echo Exit status is $status >> $OUT.new
 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
@@ -37,7 +39,8 @@ status=$?
 echo Exit status is $status >> $OUT.new
 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
 
-rm -rf /tmp/b
+rm -f $B
+unset B
 
 echo "ea_list /" > $OUT.new
 $DEBUGFS -w -R "ea_list /" $TMPFILE >> $OUT.new 2>&1

  parent reply	other threads:[~2016-03-06  3:55 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-13 22:37 [PATCH 0/9] e2fsprogs: save checksum seeds; fix broken xattr editing; misc fixes Darrick J. Wong
2016-02-13 22:37 ` [PATCH 1/9] libext2fs: store checksum seed in superblock Darrick J. Wong
2016-03-05 23:21   ` Theodore Ts'o
2016-02-13 22:37 ` [PATCH 2/9] tune2fs: allow user to turn on saving the checksum seed Darrick J. Wong
2016-03-05 23:36   ` Theodore Ts'o
2016-02-13 22:37 ` [PATCH 3/9] e2fsck: check the checksum seed feature flag is set correctly Darrick J. Wong
2016-03-05 23:37   ` Theodore Ts'o
2016-02-13 22:37 ` [PATCH 4/9] mke2fs: store checksum seed at format time Darrick J. Wong
2016-03-06  0:19   ` Theodore Ts'o
2016-02-13 22:37 ` [PATCH 5/9] tests: check proper operation of metadata_csum_seed Darrick J. Wong
2016-03-06  0:20   ` Theodore Ts'o
2016-02-13 22:38 ` [PATCH 6/9] filefrag: accommodate holes when calculating expected values Darrick J. Wong
2016-03-06  2:41   ` Theodore Ts'o
2016-02-13 22:38 ` [PATCH 7/9] tune2fs: confirm dangerous operations Darrick J. Wong
2016-02-15  0:49   ` Andreas Dilger
2016-02-15 16:53     ` Darrick J. Wong
2016-03-06  5:10       ` Theodore Ts'o
2016-03-06  6:24         ` Darrick J. Wong
2016-02-13 22:38 ` [PATCH 8/9] tune2fs: recover the journal Darrick J. Wong
2016-03-06  5:23   ` Theodore Ts'o
2016-02-13 22:38 ` [PATCH 9/9] libext2fs: sort keys for xattr blocks Darrick J. Wong
2016-02-14 10:37   ` Richard Purdie
2016-03-06  3:55   ` Theodore Ts'o [this message]
2016-03-06 22:08     ` Darrick J. Wong

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=20160306035514.GH10297@thunk.org \
    --to=tytso@mit.edu \
    --cc=darrick.wong@oracle.com \
    --cc=dvhart@linux.intel.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=richard.purdie@linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.