document: more reasonable Unix permission bits

For display purposes only, but helps us understand group-write logic.

bzr revid: p_christ@hol.gr-20101103112604-vi0wy1duifni2clv
This commit is contained in:
P. Christeas 2010-11-03 13:26:04 +02:00
parent 21847b3864
commit 5d6eb5dea1
1 changed files with 9 additions and 3 deletions

View File

@ -491,9 +491,15 @@ def _uid2unixperms(perms, has_owner):
""" Convert the uidperms and the owner flag to full unix bits
"""
res = 0
res |= (perms & 0x07) << 6
res |= (perms & 0x05) << 3
if not has_owner:
if has_owner:
res |= (perms & 0x07) << 6
res |= (perms & 0x05) << 3
elif perms & 0x02:
res |= (perms & 0x07) << 6
res |= (perms & 0x07) << 3
else:
res |= (perms & 0x07) << 6
res |= (perms & 0x05) << 3
res |= 0x05
return res