* [PATCH] generic/317: use id to get user id
@ 2016-09-23 16:54 Eryu Guan
2016-09-24 11:55 ` Zorro Lang
2016-09-26 9:11 ` Anatoly Pugachev
0 siblings, 2 replies; 4+ messages in thread
From: Eryu Guan @ 2016-09-23 16:54 UTC (permalink / raw)
To: fstests; +Cc: Eryu Guan
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`
_filter_output()
{
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] generic/317: use id to get user id
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
1 sibling, 0 replies; 4+ messages in thread
From: Zorro Lang @ 2016-09-24 11:55 UTC (permalink / raw)
To: fstests
On Sat, Sep 24, 2016 at 12:54:36AM +0800, Eryu Guan 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`
Looks good to me.
Reviewed-by: Zorro Lang <zlang@redhat.com>
>
> _filter_output()
> {
> --
> 2.7.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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] generic/317: use id to get user id
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
1 sibling, 1 reply; 4+ messages in thread
From: Anatoly Pugachev @ 2016-09-26 9:11 UTC (permalink / raw)
To: Eryu Guan; +Cc: fstests
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 ?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] generic/317: use id to get user id
2016-09-26 9:11 ` Anatoly Pugachev
@ 2016-09-26 12:49 ` Eryu Guan
0 siblings, 0 replies; 4+ messages in thread
From: Eryu Guan @ 2016-09-26 12:49 UTC (permalink / raw)
To: Anatoly Pugachev; +Cc: fstests
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-09-26 12:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox