1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-26 07:53:58 +00:00

create: do not store user/group for stdin data by default, see #7249

if you want user/group stored, give --stdin-user=USER / --stdin-group=GROUP.
This commit is contained in:
Thomas Waldmann 2023-01-15 00:13:18 +01:00
parent b338eb0ce8
commit 1f9c46f2b5
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01
2 changed files with 4 additions and 9 deletions

View file

@ -30,7 +30,6 @@
from ..patterns import PatternMatcher
from ..platform import is_win32
from ..platform import get_flags
from ..platform import uid2user, gid2group
from ..logger import create_logger
@ -718,15 +717,15 @@ def build_parser_create(self, subparsers, common_parser, mid_common_parser):
"--stdin-user",
metavar="USER",
dest="stdin_user",
default=uid2user(0),
help="set user USER in archive for stdin data (default: %(default)r)",
default=None,
help="set user USER in archive for stdin data (default: do not store user/uid)",
)
subparser.add_argument(
"--stdin-group",
metavar="GROUP",
dest="stdin_group",
default=gid2group(0),
help="set group GROUP in archive for stdin data (default: %(default)r)",
default=None,
help="set group GROUP in archive for stdin data (default: do not store group/gid)",
)
subparser.add_argument(
"--stdin-mode",

View file

@ -160,8 +160,6 @@ def test_create_stdin(self):
input_data = b"\x00foo\n\nbar\n \n"
self.cmd(f"--repo={self.repository_location}", "create", "test", "-", input=input_data)
item = json.loads(self.cmd(f"--repo={self.repository_location}", "list", "test", "--json-lines"))
assert item["uid"] == 0
assert item["gid"] == 0
assert item["size"] == len(input_data)
assert item["path"] == "stdin"
extracted_data = self.cmd(
@ -185,8 +183,6 @@ def test_create_content_from_command(self):
input_data,
)
item = json.loads(self.cmd(f"--repo={self.repository_location}", "list", "test", "--json-lines"))
assert item["uid"] == 0
assert item["gid"] == 0
assert item["size"] == len(input_data) + 1 # `echo` adds newline
assert item["path"] == name
extracted_data = self.cmd(f"--repo={self.repository_location}", "extract", "test", "--stdout")