From b5dbdfe90497867a70fcdd69a3e347952dff7d3a Mon Sep 17 00:00:00 2001 From: Eilís 'pidge' Ní Fhlannagáin Date: Thu, 7 Sep 2023 11:38:03 +0000 Subject: nativesdk-intercept: Fix bad intercept chgrp/chown logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Richard Purdie --- scripts/nativesdk-intercept/chgrp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'scripts/nativesdk-intercept/chgrp') 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) args = list() found = False -for i in sys.argv: + +args.append(real_chgrp) + +for i in sys.argv[1:]: if i.startswith("-"): args.append(i) continue -- cgit v1.2.3-54-g00ecf