diff options
author | Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com> | 2023-09-07 11:38:03 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-09-08 22:59:47 +0100 |
commit | b5dbdfe90497867a70fcdd69a3e347952dff7d3a (patch) | |
tree | 0e69327d43a153130227c3048c0bacd03b601859 /scripts/nativesdk-intercept/chgrp | |
parent | a8f3ebc4e0ab5caa9c715798d19ac6dbd15d3957 (diff) | |
download | poky-b5dbdfe90497867a70fcdd69a3e347952dff7d3a.tar.gz |
nativesdk-intercept: Fix bad intercept chgrp/chown logic
Running either of these ends up corrupting the os.execv args.
If we run:
./scripts/nativesdk-intercept/chown -R foo:foo bar
The loop here ends up missing the conversion of foo:foo to root:root because
it sees sys.argv[0] and assumes that it's the user:group argument and that we
should convert that. We end up a os.execv(path, args) that have the following
args:
['root:root', '-R', 'foo:foo', 'bar']
As os.execv ignores args[0], we can just populate it with sys.argv[0] and then
loop through sys.argv[1:]. As both chgrp and chown would have either flags and
USER[:GROUP] next, this fixes the issue.
(From OE-Core rev: 2a75f647ec7696d353f4b09099d777ba53f34d36)
Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/nativesdk-intercept/chgrp')
-rwxr-xr-x | scripts/nativesdk-intercept/chgrp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/nativesdk-intercept/chgrp b/scripts/nativesdk-intercept/chgrp index 30cc417d3a..f8ae84b8b3 100755 --- a/scripts/nativesdk-intercept/chgrp +++ b/scripts/nativesdk-intercept/chgrp | |||
@@ -14,7 +14,10 @@ real_chgrp = shutil.which('chgrp', path=path) | |||
14 | args = list() | 14 | args = list() |
15 | 15 | ||
16 | found = False | 16 | found = False |
17 | for i in sys.argv: | 17 | |
18 | args.append(real_chgrp) | ||
19 | |||
20 | for i in sys.argv[1:]: | ||
18 | if i.startswith("-"): | 21 | if i.startswith("-"): |
19 | args.append(i) | 22 | args.append(i) |
20 | continue | 23 | continue |