1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-16 00:23:52 +03:00

python:tdb_util: "samba-tool domain backup offline" hangs

GNU getopt(3) is by default non-POSIX compliant and accepts options after
positional arguments (unless forced with POSIXLY_CORRECT). This is not portable,
e..g., on FreeBSD. Put options first and then positional arguments.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15804

Signed-off-by: Andrea Venturoli <ml@netfence.it>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
This commit is contained in:
Andrea Venturoli
2025-02-19 08:51:16 +01:00
committed by Douglas Bagnall
parent 84919f47e1
commit 7e083a6b3a

View File

@@ -37,9 +37,10 @@ def tdb_copy(file1, file2, readonly=False):
raise FileNotFoundError(2, "could not find tdbbackup tool: "
"is tdb-tools installed?")
tdbbackup_cmd = [toolpath, "-s", ".copy.tdb", file1]
if readonly:
tdbbackup_cmd.append("-r")
tdbbackup_cmd = [toolpath, "-r", "-s", ".copy.tdb", file1]
else:
tdbbackup_cmd = [toolpath, "-s", ".copy.tdb", file1]
status = subprocess.check_call(tdbbackup_cmd, close_fds=True, shell=False)