Skip to contentSkip to conversation

lib/bb/utils: prevent movefile from changing dest dir permissions

PATCH In review Peter Kjellerstedt 1 participant 2 messages Apr 10, 2018 – Apr 18, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/bb/utils: prevent movefile from changing dest dir permissions

From: Mattias Hansson <[email protected]>

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/lib/bb/utils.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
bitbake/lib/bb/utils.py +2 -2
index 8b739d7849..378e699e0c 100644
@@ -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)
Signature · 1 line
2.12.0
#1 lore raw

Any chance of this making it into Sumo?

//Peter

Quoted 51 lines

-----Original Message-----
From: [email protected] [mailto:bitbake- [email protected]] On Behalf Of Peter Kjellerstedt
Sent: den 10 april 2018 16:45
To: [email protected]
Subject: [bitbake-devel] [PATCH] lib/bb/utils: prevent movefile from changing dest dir permissions

From: Mattias Hansson <[email protected]>

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/lib/bb/utils.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
bitbake/lib/bb/utils.py +0 -0
index 8b739d7849..378e699e0c 100644
@@ -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)
--
2.12.0

--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel