diff options
author | Andreas Hasenack <andreas@mandriva.com> | 2008-01-11 13:31:09 +0000 |
---|---|---|
committer | Andreas Hasenack <andreas@mandriva.com> | 2008-01-11 13:31:09 +0000 |
commit | 949ca6076e8b90695f7dba5d0f0e860ec731e138 (patch) | |
tree | 09f5ddd4d01a9b1f549a4cecf3bee56e8c514953 /share | |
parent | 8008f5d72be144a46b1cb48613e0dc785aee1aad (diff) | |
download | msec-949ca6076e8b90695f7dba5d0f0e860ec731e138.tar msec-949ca6076e8b90695f7dba5d0f0e860ec731e138.tar.gz msec-949ca6076e8b90695f7dba5d0f0e860ec731e138.tar.bz2 msec-949ca6076e8b90695f7dba5d0f0e860ec731e138.tar.xz msec-949ca6076e8b90695f7dba5d0f0e860ec731e138.zip |
- oops, revert 232939, more changes got into that commit than I wanted
Diffstat (limited to 'share')
-rwxr-xr-x | share/Perms.py | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/share/Perms.py b/share/Perms.py index ff4af73..59dab97 100755 --- a/share/Perms.py +++ b/share/Perms.py @@ -117,6 +117,20 @@ def build_non_localfs_regexp(): else: return re.compile(regexp + REGEXP_END) +# resolv symlink +def get_sylink_name(path): + try: + p = os.readlink(path) + except OSError: + return path + if p and p[0] != '/': + p = os.path.dirname(path) + '/' + p + p = os.path.abspath(p) + if p == path: + return path + else: + return get_sylink_name(p) + # put the new perm/group/owner in the assoc variable according to the # content of the path file. assoc = {} @@ -178,15 +192,20 @@ def fix_perms(path, _interactive, force): if fieldcount == 4: for f in glob.glob(fields[0]): newperm = perm - f = os.path.realpath(f) + if fs_regexp and fs_regexp.search(f): + _interactive and log(_('Non local file: "%s". Nothing changed.') % fields[0]) + continue try: full = os.lstat(f) except OSError: continue - if fs_regexp and fs_regexp.search(f): - _interactive and log(_('Non local file: "%s". Nothing changed.') % fields[0]) - continue + if stat.S_ISLNK(full[stat.ST_MODE]): + f = get_sylink_name(f) + try: + full = os.stat(f) + except OSError: + continue mode = stat.S_IMODE(full[stat.ST_MODE]) |