[oe-commits] [openembedded-core] 18/19: bash: run bash ptest as non-root user

git at git.openembedded.org git at git.openembedded.org
Fri May 31 21:24:57 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 893345db7cf37080fc46bd674075446e62eae987
Author: Sakib Sajal <sakib.sajal at windriver.com>
AuthorDate: Fri May 31 16:25:52 2019 -0400

    bash: run bash ptest as non-root user
    
    new-exp ptest fails as it expects non-root user.
    
    >From the failed ptest log:
       < new-exp.tests: the test suite should not be run as root
       628c627
       < argv[1] = <host(2)[5.0]# >
       ---
       > argv[1] = <host(2)[5.0]$ >
       FAIL: run-new-exp
    
    Many of the ptests declare that they should not be run as root
    and a few fail since the expected result strings are for a
    user shell.
    
    When ptests are run as bash_user (non-root) the glob test
    fails with error:
        run-glob-test
        59,60d58
        < touch: cannot touch 'a?': Permission denied
        < touch: cannot touch 'aa': Permission denied
    
    So ensure that the bash/ptest/tests directory is owned by the
    bash_user while the tests are being run and return it to root
    owner afterwards.
    
    Signed-off-by: Sakib Sajal <sakib.sajal at windriver.com>
    Signed-off-by: Randy Macleod <randy.macleod at windriver.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/recipes-extended/bash/bash/run-ptest | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-extended/bash/bash/run-ptest b/meta/recipes-extended/bash/bash/run-ptest
index c61fabd..c0cf27b 100644
--- a/meta/recipes-extended/bash/bash/run-ptest
+++ b/meta/recipes-extended/bash/bash/run-ptest
@@ -19,4 +19,8 @@ then
         echo "Warning: The de_DE* locales is needed to run the intl.tests, please add it."
 fi
 
-make -k THIS_SH=/bin/bash BUILD_DIR=`pwd` srcdir=`pwd`  runtest
+useradd bash_user
+chown -R bash_user:bash_user ./tests
+su bash_user -c "make -k THIS_SH=/bin/bash BUILD_DIR=`pwd` srcdir=`pwd` runtest"
+chown -R root:root ./tests
+userdel bash_user

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list