From: Mattias Hansson Date: Tue, 10 Apr 2018 14:44:51 +0000 (+0200) Subject: bitbake: lib/bb/utils: prevent movefile from changing dest dir permissions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4338a9420b187b034f9a3658f8a168565ed1cbf;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git 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 Signed-off-by: Peter Kjellerstedt Signed-off-by: Richard Purdie --- diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 8b739d78497..378e699e0c8 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): return None # failure try: if didcopy: - os.lchown(dest, sstat[stat.ST_UID], sstat[stat.ST_GID]) - os.chmod(dest, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown + os.lchown(destpath, sstat[stat.ST_UID], sstat[stat.ST_GID]) + os.chmod(destpath, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown os.unlink(src) except Exception as e: print("movefile: Failed to chown/chmod/unlink", dest, e)