-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add helper class to manage Borg version and supported features. #250
Add helper class to manage Borg version and supported features. #250
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some stuff i found.
@@ -0,0 +1,24 @@ | |||
from pkg_resources import parse_version | |||
|
|||
MIN_BORG_FOR_FEATURE = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zstd compression comes to mind. present since 1.1.4.
src/vorta/borg/_compatibility.py
Outdated
from pkg_resources import parse_version | ||
|
||
MIN_BORG_FOR_FEATURE = { | ||
'REPOKEY_BLAKE2': parse_version('1.1.4'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blake2 since 1.1.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guess the key should be rather named 'BLAKE2' (it applies to repokey and also to keyfile modes).
|
||
MIN_BORG_FOR_FEATURE = { | ||
'REPOKEY_BLAKE2': parse_version('1.1.4'), | ||
# add new version-checks here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from our docs/changes.rst:
- pre-1.1.4 potential data corruption issue
- pre-1.0.9 manifest spoofing vulnerability (CVE-2016-10099)
- pre-1.0.9 potential data loss
vorta could warn for < 1.1.4 or < 1.0.9 if you like.
src/vorta/views/repo_add_dialog.py
Outdated
'keyfile-blake2') | ||
|
||
if app.borg_compat.check('REPOKEY_BLAKE2'): | ||
self.encryptionComboBox.addItem(self.tr('Keyfile-Blake2 (Key stored in home directory)'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the key naming fix, (see above) this will read less strange.
a86ac4c
to
be5e5f2
Compare
Thanks for the input. Made some more changes:
|
@@ -1,7 +1,8 @@ | |||
from pkg_resources import parse_version | |||
|
|||
MIN_BORG_FOR_FEATURE = { | |||
'REPOKEY_BLAKE2': parse_version('1.1.4'), | |||
'BLAKE2': parse_version('1.1.4'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.1.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't you say there were some issues with blake2 before 1.1.4? So I figured I use the version where it was rock-solid.
src/vorta/views/repo_tab.py
Outdated
def toggle_available_compression(self): | ||
use_zstd = borg_compat.check('ZSTD') | ||
self.repoCompression.model().item(1).setEnabled(use_zstd) | ||
self.repoCompression.model().item(2).setEnabled(use_zstd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hardcoded 1 and 2 here is a potential future bug.
maybe determine offset somehow or add a comment above the place where the compression menu items are added to update this place in case of changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually considered this, but finding the offset needs an extra statement.
Since you noticed this as well, I added selecting the offset by value, rather than index.
self.repoCompression.model().item(2).setEnabled(use_zstd) | ||
for algo in ['zstd,3', 'zstd,8']: | ||
ix = self.repoCompression.findData(algo) | ||
self.repoCompression.model().item(ix).setEnabled(use_zstd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice and solid! :)
Fixes #205