* [PATCH] xfstests: check if qa user can execute commands
@ 2011-12-06 9:56 Jan Schmidt
2011-12-06 15:13 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Jan Schmidt @ 2011-12-06 9:56 UTC (permalink / raw)
To: linux-btrfs, xfs
_require_user only checks if the qa user exists in /etc/passwd. It may exist
though still not be able to execute anything (e.g. with a /bin/false shell).
_user_do cannot determine failure to execute the given command, as it uses
_user_do_filter for post-processing which succeeds even if the command
fails. Thus, the check should be performed by _require_user.
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
---
common.rc | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/common.rc b/common.rc
index cab0b64..f540a79 100644
--- a/common.rc
+++ b/common.rc
@@ -897,6 +897,8 @@ _require_user()
qa_user=fsgqa
_cat_passwd | grep -q $qa_user
[ "$?" == "0" ] || _notrun "$qa_user user not defined."
+ echo /bin/true | su $qa_user
+ [ "$?" == "0" ] || _notrun "$qa_user cannot execute commands."
}
_filter_user_do()
--
1.7.2.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] xfstests: check if qa user can execute commands
2011-12-06 9:56 [PATCH] xfstests: check if qa user can execute commands Jan Schmidt
@ 2011-12-06 15:13 ` Christoph Hellwig
2011-12-06 15:16 ` Jan Schmidt
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2011-12-06 15:13 UTC (permalink / raw)
To: Jan Schmidt; +Cc: linux-btrfs, xfs
On Tue, Dec 06, 2011 at 10:56:29AM +0100, Jan Schmidt wrote:
> _require_user only checks if the qa user exists in /etc/passwd. It may exist
> though still not be able to execute anything (e.g. with a /bin/false shell).
>
> _user_do cannot determine failure to execute the given command, as it uses
> _user_do_filter for post-processing which succeeds even if the command
> fails. Thus, the check should be performed by _require_user.
Looks good. Wouldn't
su $qa_user -c /bin/true
be the more normal way to write that test?
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xfstests: check if qa user can execute commands
2011-12-06 15:13 ` Christoph Hellwig
@ 2011-12-06 15:16 ` Jan Schmidt
2011-12-06 15:18 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Jan Schmidt @ 2011-12-06 15:16 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-btrfs, Jan Schmidt, xfs
On 06.12.2011 16:13, Christoph Hellwig wrote:
> On Tue, Dec 06, 2011 at 10:56:29AM +0100, Jan Schmidt wrote:
>> _require_user only checks if the qa user exists in /etc/passwd. It may exist
>> though still not be able to execute anything (e.g. with a /bin/false shell).
>>
>> _user_do cannot determine failure to execute the given command, as it uses
>> _user_do_filter for post-processing which succeeds even if the command
>> fails. Thus, the check should be performed by _require_user.
>
> Looks good. Wouldn't
>
> su $qa_user -c /bin/true
>
> be the more normal way to write that test?
I agree. I saw this and thought I'd adapt the (sometimes strange)
predominant bash programming style:
921 _user_do()
922 {
923 if [ "$HOSTOS" == "IRIX" ]
924 then
925 echo $1 | /bin/bash "su $qa_user 2>&1" | _filter_user_do
926 else
927 echo $1 | su $qa_user 2>&1 | _filter_user_do
928 fi
929 }
-Jan
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xfstests: check if qa user can execute commands
2011-12-06 15:16 ` Jan Schmidt
@ 2011-12-06 15:18 ` Christoph Hellwig
0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2011-12-06 15:18 UTC (permalink / raw)
To: Jan Schmidt; +Cc: Christoph Hellwig, linux-btrfs, Jan Schmidt, xfs
On Tue, Dec 06, 2011 at 04:16:45PM +0100, Jan Schmidt wrote:
> I agree. I saw this and thought I'd adapt the (sometimes strange)
> predominant bash programming style:
Maybe the IRIX su command didn't support -c. I'll put your patch in
as-is.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-12-06 15:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-06 9:56 [PATCH] xfstests: check if qa user can execute commands Jan Schmidt
2011-12-06 15:13 ` Christoph Hellwig
2011-12-06 15:16 ` Jan Schmidt
2011-12-06 15:18 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox