]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commit
nativesdk-intercept: Fix bad intercept chgrp/chown logic
authorEilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com>
Thu, 7 Sep 2023 11:38:03 +0000 (11:38 +0000)
committerSteve Sakoman <steve@sakoman.com>
Fri, 13 Oct 2023 02:23:08 +0000 (16:23 -1000)
commite27982afaed33e5823962f7fefe6f709c10e9107
tree525d184e3b9a9e9c7419d6296536f1dc4a46b15f
parent7166f503211c39542d828aa3fef5006dccf2c07a
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.

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>
scripts/nativesdk-intercept/chgrp
scripts/nativesdk-intercept/chown