mirror of https://github.com/borgbackup/borg.git
process_pipe: allow creating item w/o user/group/uid/gid, see #7249
This commit is contained in:
parent
262812e76f
commit
b338eb0ce8
|
@ -1399,28 +1399,32 @@ class FilesystemObjectProcessors:
|
||||||
item.update(self.metadata_collector.stat_attrs(st, path)) # can't use FD here?
|
item.update(self.metadata_collector.stat_attrs(st, path)) # can't use FD here?
|
||||||
return status
|
return status
|
||||||
|
|
||||||
def process_pipe(self, *, path, cache, fd, mode, user, group):
|
def process_pipe(self, *, path, cache, fd, mode, user=None, group=None):
|
||||||
status = "i" # stdin (or other pipe)
|
status = "i" # stdin (or other pipe)
|
||||||
self.print_file_status(status, path)
|
self.print_file_status(status, path)
|
||||||
status = None # we already printed the status
|
status = None # we already printed the status
|
||||||
uid = user2uid(user)
|
if user is not None:
|
||||||
if uid is None:
|
uid = user2uid(user)
|
||||||
raise Error("no such user: %s" % user)
|
if uid is None:
|
||||||
gid = group2gid(group)
|
raise Error("no such user: %s" % user)
|
||||||
if gid is None:
|
else:
|
||||||
raise Error("no such group: %s" % group)
|
uid = None
|
||||||
|
if group is not None:
|
||||||
|
gid = group2gid(group)
|
||||||
|
if gid is None:
|
||||||
|
raise Error("no such group: %s" % group)
|
||||||
|
else:
|
||||||
|
gid = None
|
||||||
t = int(time.time()) * 1000000000
|
t = int(time.time()) * 1000000000
|
||||||
item = Item(
|
item = Item(path=path, mode=mode & 0o107777 | 0o100000, mtime=t, atime=t, ctime=t) # forcing regular file mode
|
||||||
path=path,
|
if user is not None:
|
||||||
mode=mode & 0o107777 | 0o100000, # forcing regular file mode
|
item.user = user
|
||||||
uid=uid,
|
if group is not None:
|
||||||
user=user,
|
item.group = group
|
||||||
gid=gid,
|
if uid is not None:
|
||||||
group=group,
|
item.uid = uid
|
||||||
mtime=t,
|
if gid is not None:
|
||||||
atime=t,
|
item.gid = gid
|
||||||
ctime=t,
|
|
||||||
)
|
|
||||||
self.process_file_chunks(item, cache, self.stats, self.show_progress, backup_io_iter(self.chunker.chunkify(fd)))
|
self.process_file_chunks(item, cache, self.stats, self.show_progress, backup_io_iter(self.chunker.chunkify(fd)))
|
||||||
item.get_size(memorize=True)
|
item.get_size(memorize=True)
|
||||||
self.stats.nfiles += 1
|
self.stats.nfiles += 1
|
||||||
|
|
Loading…
Reference in New Issue