[LTP] [RFC PATCH 1/9] testcases: su: Fix userdel use
Cyril Hrubis
chrubis@suse.cz
Mon Apr 23 12:13:09 CEST 2018
Hi!
> In case "getent" command is not available in the system,
> the userdel command will never be executed and for the
> second use, the test will fail with:
> useradd: user 'su_usr1' already exists
>
> Fix that by moving "userdel" command in a new line.
>
> Signed-off-by: Myl??ne Josserand <mylene.josserand@bootlin.com>
> ---
> testcases/commands/su/su01 | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/commands/su/su01 b/testcases/commands/su/su01
> index 34386d937..1eedcb636 100755
> --- a/testcases/commands/su/su01
> +++ b/testcases/commands/su/su01
> @@ -86,7 +86,8 @@ rm -f $TEST_ENV_FILE > /dev/null 2>&1
> #Create 1st test user
> #erase user if he may exist , so we can have a clean en
> rm -rf /home/$TEST_USER1
> - getent passwd $TEST_USER1 > /dev/null 2>&1 && userdel $TEST_USER1
> + getent passwd $TEST_USER1 > /dev/null 2>&1
> + userdel $TEST_USER1
I'm pretty sure this was intended to be:
"delete user only if it exists already"
So the whole getent line is useless after this change.
Also I suppose we shouldn't delete users in the test setup anyways, but
the whole tests is a mess and should be cleaned up...
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list