Closed velleto closed 4 years ago
we use these argparse options for --recompress
:
nargs='?', default='never', const='if-different',
choices=('never', 'if-different', 'always')
About "const", see there (2nd item in the list, see nargs):
https://docs.python.org/3/library/argparse.html#const
So, default
means here the value that is set if --recompress
is not given on the commandline and that obviously should be never
.
const
is the value that is set if only --recompress
is given, but that is not followed by a specific mode. if-different
is a good value for that because it will only recompress if the original chunk's compression algorithm is different than the desired compression algorithm.
So, this looks correct to me, am I missing something?
So, to summarize: there is nothing wrong, but we could make the docs more clear, so it can not be misunderstood (just document all 4 cases).
@velleto did you see my feedback?
Yes. Thank you for responding so quickly.
I stand corrected: you are absolutely right. I am updating the PR right now
Have you checked borgbackup docs, FAQ, and open Github issues?: Yes Is this a BUG / ISSUE report or a QUESTION?: Issue/Question Borg version: 1.1.11 (Other information omitted since not relevant to issue)
I appreciate that
recreate
is an experimental feature and is likely to undergo heavy development until full release (I'm looking forward to the proposed changes in #3631 in particular!). However, the following issue is a UI issue which is perhaps best fixed whistrecreate
is still marked "experimental" and backwards compatibility is not as important.Currently the default
MODE
when--recompress
ing isnever
. This is is so counter intuitive that even the documentation gets it wrong:In the documentation (
man borg-recreate
) underExamples
it currently states thathowever, according to discussions in #3617, and the merge #3676 (which reflects current documentation), I believe the second borg command would not recompress the data (since the default
MODE
isnever
)? I think the example should beIf I have understood correctly, there is no difference between
if-different
andalways
in this context because the previous compression waslz4
and now it iszlib
?To mitigate this, I would suggest that borg should throws an error if no
MODE
is specified.In fact, it might be worth going one step further, and removing the
never
MODE
entirely. I'm not sure in which contextmakes sense? What is the difference between this, and
? Perhaps it to underline the fact that if an archive is
recreate
d without--compression
, then the previous compression algorithms and levels are used? If so, I think this should be documented more clearly.However, I appreciate that, for backwards compatibility (even as an experimental feauture), this may not be feasible. As a compromise, I would create a warning in the style of the experimental feature warning:
The rationale for the proposed changes is that --- before changes in #3631 are implemented -- it could be a very time-wasting endeavor to
recreate --compress --compression L[,C]
only to find out ~24 hrs later that no compression took place.Further, I would stress the importance of the
MODE
in the first line of the description. That is, changeto
Thank you for your hard work on this project.
(Edited for clarification and wording)