All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <guaneryu@gmail.com>
To: Zorro Lang <zlang@redhat.com>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH] generic/062: filter redundant output by getfattr
Date: Tue, 17 Jul 2018 11:02:11 +0800	[thread overview]
Message-ID: <20180717030211.GI2830@desktop> (raw)
In-Reply-To: <20180716081243.GI4893@hp-dl360g9-06.rhts.eng.pek2.redhat.com>

On Mon, Jul 16, 2018 at 04:12:43PM +0800, Zorro Lang wrote:
> On Fri, Jul 13, 2018 at 02:39:25PM +0800, Eryu Guan wrote:
> > On Thu, Jul 12, 2018 at 11:59:26PM +0800, Zorro Lang wrote:
> > > When getfattr dumps values of all extended attributes (-d option),
> > > it doesn't print empty extended attributes. e.g: user.name. But
> > > from attr-2.4.48 this behavior is changed,  new getfattr prints
> > > user.name="".
> > > 
> > > The {=""} will break the golden image, so filter the redundant =""
> > > at the end if it has.
> > > 
> > > Signed-off-by: Zorro Lang <zlang@redhat.com>
> > > ---
> > > 
> > > Hi,
> > > 
> > > This's a bad news. Latest attr package attr-2.4.48 changed his
> > > behavior as above. And this's different with attr-2.4.47.
> > > 
> > > With old attr:
> > > # setfattr -h -n user.name testfile
> > > # getfattr -d -n user.name testfile                                                                                                                                     
> > > # file: testfile                               
> > > user.name
> > > 
> > > With new attr:
> > > # setfattr -h -n user.name testfile
> > > # getfattr -d -n user.name testfile                                                                                                                                     
> > > # file: testfile                               
> > > user.name=""
> > > 
> > > Note: -d option is necessary
> > > 
> > > This little difference will break golden image. So this's the problem.
> > > If you have better idea than this patch, please tell me.
> > > 
> > > Thanks,
> > > Zorro
> > > 
> > > 
> > >  tests/generic/062 | 6 +++++-
> > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/tests/generic/062 b/tests/generic/062
> > > index df67960d..4fc2dc46 100755
> > > --- a/tests/generic/062
> > > +++ b/tests/generic/062
> > > @@ -29,9 +29,13 @@ _cleanup()
> > >  }
> > >  trap "_cleanup; exit \$status" 0 1 2 3 15
> > >  
> > > +# When getfattr dump values of all extended attributes, it print empty attr
> > > +# as user.name before, but new getfattr print it as user.name="". For match
> > > +# the golden image, filter the redundant ="" at the end.
> > >  getfattr()
> > >  {
> > > -    $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch
> > > +    $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch | \
> > > +	sed -e 's/=\"\"//'
> > >  }
> > 
> > This should really be done by a new helper function that hides all the
> > details, so future tests could just take use of the helper.
> 
> OK. So how about a common function named _getfattr in common/attr, to instead
> of all $GETFATTR_PROG (or just g/062).

_getfattr() is fine, converting all existing bare getfattr calls would
be good.

Thanks!

Eryu

> 
> Or a a common function named _filter_getfattr, to filter some $GETFATTR_PROG
> output if a case need it.
> 
> _getfattr()
> {
> 	$GETFATTR_PROG $@ 2>&1 | _filter_testdir_and_scratch | \
> 		sed -e 's/=\"\"//'
> }
> 
> Or
> 
> _filter_getfattr()
> {
> 	_filter_testdir_and_scratch | sed -e 's/=\"\"//'
> }
> 
> Thanks,
> Zorro
> 
> > 
> > Thanks,
> > Eryu
> > 
> > >  
> > >  setfattr()
> > > -- 
> > > 2.14.4
> > > 
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > --
> > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2018-07-17  3:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-12 15:59 [PATCH] generic/062: filter redundant output by getfattr Zorro Lang
2018-07-13  6:39 ` Eryu Guan
2018-07-16  8:12   ` Zorro Lang
2018-07-17  3:02     ` Eryu Guan [this message]

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=20180717030211.GI2830@desktop \
    --to=guaneryu@gmail.com \
    --cc=fstests@vger.kernel.org \
    --cc=zlang@redhat.com \
    /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.