summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com>2023-09-07 11:38:03 +0000
committerSteve Sakoman <steve@sakoman.com>2023-10-18 05:25:19 -1000
commit6b09ead55ad1e9d256f1ea9c8ce7b778a67c3fad (patch)
treef302db44dcce8718fba982aa86969da148a93003
parent6f40a967bde1508e1e6c8574f95145e2175513b0 (diff)
downloadpoky-6b09ead55ad1e9d256f1ea9c8ce7b778a67c3fad.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: e27982afaed33e5823962f7fefe6f709c10e9107) Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 2a75f647ec7696d353f4b09099d777ba53f34d36) Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rwxr-xr-xscripts/nativesdk-intercept/chgrp5
-rwxr-xr-xscripts/nativesdk-intercept/chown5
2 files changed, 8 insertions, 2 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)
14args = list() 14args = list()
15 15
16found = False 16found = False
17for i in sys.argv: 17
18args.append(real_chgrp)
19
20for 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
diff --git a/scripts/nativesdk-intercept/chown b/scripts/nativesdk-intercept/chown
index 3914b3e384..0805ceb70a 100755
--- a/scripts/nativesdk-intercept/chown
+++ b/scripts/nativesdk-intercept/chown
@@ -14,7 +14,10 @@ real_chown = shutil.which('chown', path=path)
14args = list() 14args = list()
15 15
16found = False 16found = False
17for i in sys.argv: 17
18args.append(real_chown)
19
20for 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