public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <eguan@redhat.com>
To: Anatoly Pugachev <matorola@gmail.com>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH] generic/317: use id to get user id
Date: Mon, 26 Sep 2016 20:49:31 +0800	[thread overview]
Message-ID: <20160926124931.GI27776@eguan.usersys.redhat.com> (raw)
In-Reply-To: <CADxRZqyaupU9ThvAcT7w7vu5LUgV=eGLDSmN2ZXb3By4iYDs5g@mail.gmail.com>

On Mon, Sep 26, 2016 at 12:11:24PM +0300, Anatoly Pugachev wrote:
> On Fri, Sep 23, 2016 at 7:54 PM, Eryu Guan <eguan@redhat.com> wrote:
> >
> > Greping username "fsgqa" in passwd file to get user id doesn't
> > always work, because the given username could match multiple
> > entries, e.g. when we have user "123456-fsgqa" (used by other tests)
> > in passwd file.
> >
> > Fix it by using "id -u $qa_user" to get the user id directly.
> >
> > Signed-off-by: Eryu Guan <eguan@redhat.com>
> > ---
> >  tests/generic/317 | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tests/generic/317 b/tests/generic/317
> > index 9d9499b..7e40b1f 100755
> > --- a/tests/generic/317
> > +++ b/tests/generic/317
> > @@ -61,7 +61,7 @@ _require_scratch
> >  _require_user
> >  _require_ugid_map
> >  _require_userns
> > -qa_user_id=`grep $qa_user /etc/passwd |awk -F: '{print $3}'`
> > +qa_user_id=`id -u $qa_user`
> 
> 
> shouldn't it use _cat_passwd() from common/rc ?

I thought about it too, but _cat_passwd has the same problem as grep
/etc/passwd directly, and "id -u $qa_user" just works fine too in NIS
env. So I think this fix is fine.

Thanks,
Eryu

      reply	other threads:[~2016-09-26 12:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-23 16:54 [PATCH] generic/317: use id to get user id Eryu Guan
2016-09-24 11:55 ` Zorro Lang
2016-09-26  9:11 ` Anatoly Pugachev
2016-09-26 12:49   ` 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=20160926124931.GI27776@eguan.usersys.redhat.com \
    --to=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=matorola@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox