mirror of
https://git.yoctoproject.org/git/poky
synced 2026-01-04 16:10:04 +00:00
license.bbclass: fix warnings when run in unprivileged "container" env
An unprivileged "container" environment like this[1] doesn't have root
account (uid 0) which causes tons of "Invalid argument" warnings:
$ bitbake ...
...
WARNING: Could not copy license file [src] to [dest]: [Errno 22] Invalid argument: '[src]'
WARNING: Could not copy license file [src] to [dest]: [Errno 22] Invalid argument: '[src]'
WARNING: Could not copy license file [src] to [dest]: [Errno 22] Invalid argument: '[src]'
...
Fix it by handling EINVAL similar to existing handling of EPERM (which
was added for when not running under pseudo).
[1]: The real environemnt is buildFHSUserEnv from NixOS/nixpkgs, but a
demonstration of the issue can be done like this:
$ touch f
$ unshare --user --mount chown 0:0 f
chown: changing ownership of ‘f’: Invalid argument
(From OE-Core rev: d00b2250a6afebd7d1373c04b4006290f0cd4043)
Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
43071a0d67
commit
f7fed7ce75
|
|
@ -354,9 +354,11 @@ def copy_license_files(lic_files_paths, destdir):
|
|||
os.chown(dst,0,0)
|
||||
except OSError as err:
|
||||
import errno
|
||||
if err.errno == errno.EPERM:
|
||||
# suppress "Operation not permitted" error, as
|
||||
# sometimes this function is not executed under pseudo
|
||||
if err.errno in (errno.EPERM, errno.EINVAL):
|
||||
# Suppress "Operation not permitted" error, as
|
||||
# sometimes this function is not executed under pseudo.
|
||||
# Also ignore "Invalid argument" errors that happen in
|
||||
# some (unprivileged) container environments (no root).
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user