mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-26 16:04:06 +00:00
extract: chown only if we have u/g info in archived item, see #7249
also: move get_item_uid_gid() to "not is_win32" block for now.
This commit is contained in:
parent
1f9c46f2b5
commit
4dcc48f5c4
1 changed files with 5 additions and 2 deletions
|
@ -928,9 +928,12 @@ def restore_attrs(self, path, item, symlink=False, fd=None):
|
||||||
Does not access the repository.
|
Does not access the repository.
|
||||||
"""
|
"""
|
||||||
backup_io.op = "attrs"
|
backup_io.op = "attrs"
|
||||||
uid, gid = get_item_uid_gid(item, numeric=self.numeric_ids)
|
# This code is a bit of a mess due to OS specific differences.
|
||||||
# This code is a bit of a mess due to os specific differences
|
|
||||||
if not is_win32:
|
if not is_win32:
|
||||||
|
# by using uid_default = -1 and gid_default = -1, they will not be restored if
|
||||||
|
# the archived item has no information about them.
|
||||||
|
uid, gid = get_item_uid_gid(item, numeric=self.numeric_ids, uid_default=-1, gid_default=-1)
|
||||||
|
# if uid and/or gid is -1, chown will keep it as is and not change it.
|
||||||
try:
|
try:
|
||||||
if fd:
|
if fd:
|
||||||
os.fchown(fd, uid, gid)
|
os.fchown(fd, uid, gid)
|
||||||
|
|
Loading…
Reference in a new issue