From af7d3ca600800120a07941fe9805db603befa7e4 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 22 Nov 2006 06:20:17 +0000 Subject: [PATCH] Fix apply_permissions logic for cases where mode is unspecified. svn path=/main/trunk/; revision=5115 --- pym/portage_util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pym/portage_util.py b/pym/portage_util.py index 4c7e3176f..1e7afe4b6 100644 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -558,7 +558,10 @@ def apply_permissions(filename, uid=-1, gid=-1, mode=-1, mask=-1, # bits, so those bits are restored if necessary. if modified and new_mode == -1 and \ (st_mode & stat.S_ISUID or st_mode & stat.S_ISGID): - new_mode = mode & 07777 + if mode == -1: + new_mode = st_mode + elif mode & stat.S_ISUID or mode & stat.S_ISGID: + new_mode = mode & 07777 if not follow_links and stat.S_ISLNK(stat_cached.st_mode): # Mode doesn't matter for symlinks. -- 2.26.2