From: Andrea Venturoli Date: Wed, 19 Feb 2025 07:51:16 +0000 (+0100) Subject: python:tdb_util: "samba-tool domain backup offline" hangs X-Git-Tag: tevent-0.17.0~617 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e083a6b3a12933b79ef19ccbd4c13bfa0203498;p=thirdparty%2Fsamba.git 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 Reviewed-by: Douglas Bagnall Reviewed-by: Jennifer Sutton --- diff --git a/python/samba/tdb_util.py b/python/samba/tdb_util.py index 99b6e02e03f..202fbdb3f8b 100644 --- a/python/samba/tdb_util.py +++ b/python/samba/tdb_util.py @@ -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)