borg icon indicating copy to clipboard operation
borg copied to clipboard

Clarify if positional arguments are allowed in-between since Python 3.7+

Open savchenko opened this issue 4 years ago • 2 comments

Have you checked borgbackup docs, FAQ, and open Github issues?

Yes

Is this a BUG / ISSUE report or a QUESTION?

QUESTION

System information. For client/server mode post info for both machines.

Your borg version (borg -V).

Borg 1.1.16

Operating system (distribution) and version.

Debian 11, Python 3.9.2

Hardware / network configuration, and filesystems used.

N/A

How much data is handled by borg?

N/A

Full borg commandline that lead to the problem (leave away excludes and passwords)

N/A

Describe the problem you're observing.

Can you reproduce the problem? If so, describe how. If not, describe troubleshooting steps you took before opening the issue.

man borg, NOTES section states:

Borg only supports taking options (-s and --progress in the example) to the left or right of all positional arguments (repo::archive and path in the example), but not in between them [...] This is due to a problem in the argparse module: https://bugs.python.org/issue15112

Bug #15112 references ArgumentParser.parse_intermixed_args() as the proposed fix.

Question

Is the original warning still applicable for Borg v1.1.16 running on Python 3.9?

savchenko avatar Nov 16 '21 00:11 savchenko

Well, just try it out?

I don't think I want to make the 1.1-maint branch docs more complicated by making them python version specific.

For master, we require python >= 3.8 so if the problem is solved with that, the master branch docs could be simplified.

ThomasWaldmann avatar Nov 16 '21 12:11 ThomasWaldmann

Quote from the parse_intermixed_args docs: """These parsers do not support all the argparse features, and will raise exceptions if unsupported features are used. In particular, subparsers, argparse.REMAINDER, and mutually exclusive groups that include both optionals and positionals are not supported."""

Not sure how to parse these docs, but borg uses:

  • subparsers (all over the place)
  • argparse.REMAINDER (borg with-lock ...)

ThomasWaldmann avatar Jun 26 '22 19:06 ThomasWaldmann

Guess we can't use that.

ThomasWaldmann avatar Nov 04 '22 23:11 ThomasWaldmann