diff options
author | Mattias Hansson <mattias.hansson@axis.com> | 2018-04-10 16:44:51 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-04-23 17:26:05 +0100 |
commit | c4338a9420b187b034f9a3658f8a168565ed1cbf (patch) | |
tree | 22fa0997da480ab96bf6c4a30c7a0472c8c64d74 /bitbake | |
parent | b90e69401730310daa2bb09378cda8a833bb2e01 (diff) | |
download | poky-c4338a9420b187b034f9a3658f8a168565ed1cbf.tar.gz |
bitbake: lib/bb/utils: prevent movefile from changing dest dir permissions
Prevent movefile from falsely setting the source file's owner and
permissions on the destination directory instead of the destination
file when moving between devices.
This bug caused the last file moved into a directory to dictate the
directory's owner and permissions.
(Bitbake rev: 82ea737a0b42a8b53e11c9cde141e9e9c0bd8c40)
Signed-off-by: Mattias Hansson <mattias.hansson@axis.com>
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/utils.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 8b739d7849..378e699e0c 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -807,8 +807,8 @@ def movefile(src, dest, newmtime = None, sstat = None): | |||
807 | return None # failure | 807 | return None # failure |
808 | try: | 808 | try: |
809 | if didcopy: | 809 | if didcopy: |
810 | os.lchown(dest, sstat[stat.ST_UID], sstat[stat.ST_GID]) | 810 | os.lchown(destpath, sstat[stat.ST_UID], sstat[stat.ST_GID]) |
811 | os.chmod(dest, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown | 811 | os.chmod(destpath, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown |
812 | os.unlink(src) | 812 | os.unlink(src) |
813 | except Exception as e: | 813 | except Exception as e: |
814 | print("movefile: Failed to chown/chmod/unlink", dest, e) | 814 | print("movefile: Failed to chown/chmod/unlink", dest, e) |