diff options
author | Bjørn Forsman <bjorn.forsman@gmail.com> | 2016-04-24 18:10:35 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-09 14:37:28 +0100 |
commit | ed3115be57558ce5fe0b42a6ce1b93565c70d05f (patch) | |
tree | 56edca4a819853f5c5a7df45fc1e6f9a2733363f /meta/classes/license.bbclass | |
parent | c6864efbc055f76c9512bf33ce9b193af2dc9bf8 (diff) | |
download | poky-ed3115be57558ce5fe0b42a6ce1b93565c70d05f.tar.gz |
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 master rev: d00b2250a6afebd7d1373c04b4006290f0cd4043)
(From OE-Core rev: e49794b9fe3391073138cb6116a46b37dd5119e7)
Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/license.bbclass')
-rw-r--r-- | meta/classes/license.bbclass | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index c714da31f4..db0fc51fea 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass | |||
@@ -189,9 +189,11 @@ def copy_license_files(lic_files_paths, destdir): | |||
189 | os.chown(dst,0,0) | 189 | os.chown(dst,0,0) |
190 | except OSError as err: | 190 | except OSError as err: |
191 | import errno | 191 | import errno |
192 | if err.errno == errno.EPERM: | 192 | if err.errno in (errno.EPERM, errno.EINVAL): |
193 | # suppress "Operation not permitted" error, as | 193 | # Suppress "Operation not permitted" error, as |
194 | # sometimes this function is not executed under pseudo | 194 | # sometimes this function is not executed under pseudo. |
195 | # Also ignore "Invalid argument" errors that happen in | ||
196 | # some (unprivileged) container environments (no root). | ||
195 | pass | 197 | pass |
196 | else: | 198 | else: |
197 | raise | 199 | raise |