[OE-core] [PATCH] sanity.bbclass: show warning when chmod fails

Martin Jansa martin.jansa at gmail.com
Thu Sep 24 13:46:50 UTC 2015


On Wed, Sep 23, 2015 at 06:13:56PM +0200, Martin Jansa wrote:
> From: Alex Franco <alejandro.franco at linux.intel.com>
> 
> * for some reason this part of:
>   http://patchwork.openembedded.org/patch/102561/
>   wasn't ever merged.

I've changed the configuration on my jenkins servers, so that now it
doesn't fail.

In case someone needs that as well then you need to use mode, uid and
git parameters for mounting tmpfs, e.g.

none /home/jenkins/oe/world/shr-core/tmp-glibc/ tmpfs noatime,nodev,nosuid,size=74G,mode=777,users,exec,uid=3004,gid=3004 0 0

where 3004 is uid and gid of jenkins user which is running the bitbake.



This change is still needed, because following exception shows so much about
bbclass sanity, that average user will get confused and eventually insane.

ERROR: Execution of event handler 'check_sanity_eventhandler' failed
Traceback (most recent call last):
  File "check_sanity_eventhandler(e)", line 6, in check_sanity_eventhandler(e=<bb.event.SanityCheck object at 0x57ec3d0>)
  File "sanity.bbclass", line 34, in check_sanity(sanity_data=<bb.data_smart.DataSmart object at 0x57d5e10>)
  File "sanity.bbclass", line 155, in check_sanity_everybuild(status=<SanityStatus object at 0x57d5490>, d=<bb.data_smart.DataSmart object at 0x57d5e10>)
OSError: [Errno 1] Operation not permitted: '/home/jenkins/workspace/luneos-unstable/webos-ports/tmp-glibc'

ERROR: Command execution failed: Traceback (most recent call last):
  File "/home/jenkins/workspace/luneos-unstable/webos-ports/bitbake/lib/bb/command.py", line 101, in runAsyncCommand
    self.cooker.updateCache()
  File "/home/jenkins/workspace/luneos-unstable/webos-ports/bitbake/lib/bb/cooker.py", line 1503, in updateCache
    bb.event.fire(bb.event.SanityCheck(False), self.data)
  File "/home/jenkins/workspace/luneos-unstable/webos-ports/bitbake/lib/bb/event.py", line 170, in fire
    fire_class_handlers(event, d)
  File "/home/jenkins/workspace/luneos-unstable/webos-ports/bitbake/lib/bb/event.py", line 109, in fire_class_handlers
    execute_handler(name, handler, event, d)
  File "/home/jenkins/workspace/luneos-unstable/webos-ports/bitbake/lib/bb/event.py", line 81, in execute_handler
    ret = handler(event)
  File "check_sanity_eventhandler(e)", line 6, in check_sanity_eventhandler
  File "sanity.bbclass", line 34, in check_sanity
  File "sanity.bbclass", line 155, in check_sanity_everybuild
OSError: [Errno 1] Operation not permitted: '/home/jenkins/workspace/luneos-unstable/webos-ports/tmp-glibc'


Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
Command exited with non-zero status 1


> 
> [YOCTO #7669]
> 
> Signed-off-by: Alex Franco <alejandro.franco at linux.intel.com>
> Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
> ---
>  meta/classes/sanity.bbclass | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
> index 2eb744f..34f8618 100644
> --- a/meta/classes/sanity.bbclass
> +++ b/meta/classes/sanity.bbclass
> @@ -839,9 +839,12 @@ def check_sanity_everybuild(status, d):
>      else:
>          bb.utils.mkdirhier(tmpdir)
>          # Remove setuid, setgid and sticky bits from TMPDIR
> -        os.chmod(tmpdir, os.stat(tmpdir).st_mode & ~ stat.S_ISUID)
> -        os.chmod(tmpdir, os.stat(tmpdir).st_mode & ~ stat.S_ISGID)
> -        os.chmod(tmpdir, os.stat(tmpdir).st_mode & ~ stat.S_ISVTX)
> +        try:
> +            os.chmod(tmpdir, os.stat(tmpdir).st_mode & ~ stat.S_ISUID)
> +            os.chmod(tmpdir, os.stat(tmpdir).st_mode & ~ stat.S_ISGID)
> +            os.chmod(tmpdir, os.stat(tmpdir).st_mode & ~ stat.S_ISVTX)
> +        except OSError:
> +            bb.warn("Unable to chmod TMPDIR: %s" % tmpdir)
>          with open(checkfile, "w") as f:
>              f.write(tmpdir)
>  
> -- 
> 2.5.3
> 

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20150924/aa47f753/attachment-0002.sig>


More information about the Openembedded-core mailing list