Skip to content
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

Unclear what enfcs.Decode does (Question to Germar) #1559

Closed
buhtz opened this issue Nov 8, 2023 · 6 comments
Closed

Unclear what enfcs.Decode does (Question to Germar) #1559

buhtz opened this issue Nov 8, 2023 · 6 comments
Assignees
Labels
Discussion decision or consensus needed EncFS using the EncFS file system

Comments

@buhtz
Copy link
Member

buhtz commented Nov 8, 2023

Dear @Germar ,
please have a look at this piece of code realated to encfstools.Decode class.

# german translation changed from Snapshot to Schnappschuss.
# catch both variants otherwise old logs wouldn't get decoded.
takeSnapshot = _('Take snapshot') \
.replace('Schnappschuss', '(?:Schnappschuss|Snapshot)')

I added some debug prints but was not able to trigger that part of the code.

  • What does it do?
  • Is it relevant?

The reason for my question is if I can modify the source string _('Take snapshot') without interfering something.

Is this somehow related to this piece of code?

self.setTakeSnapshotMessage(
0, _('Take snapshot') + " (rsync: %s)" % line)

@buhtz buhtz added Discussion decision or consensus needed EncFS using the EncFS file system labels Nov 8, 2023
@Germar
Copy link
Member

Germar commented Nov 8, 2023

This is relevant to decode encrypted path in takesnapshot.log. Problem is that BiT writes translated phrase Take snapshot into the log for lines like:

#search for: [I] Take snapshot (rsync: BACKINTIME: <f+++++++++ <crypted_path>)
# [I] Take snapshot (rsync: deleting <crypted_path>)
# [I] Take snapshot (rsync: rsync: readlink_stat("...mountpoint/<crypted_path>")
# [I] Take snapshot (rsync: rsync: send_files failed to open "...mountpoint/<crypted_path>": Permission denied (13))
# [I] Take snapshot (rsync: file has vanished: "...mountpoint/<crypted_path>")
# [I] Take snapshot (rsync: <crypted_path>)

Everytime the translation changes for this phrase, this will break decoding old logs which has been created before last translation-update.

With this code I tried to fix this at least for the german translation-change. But that's a losing game anyways...

@buhtz
Copy link
Member Author

buhtz commented Nov 9, 2023

[I] Take snapshot (rsync: rsync: send_files failed to open "...
    ^^^^^^^^^^^^^

Do we talk about this string?

Do I understand that correct? Someone create encfs snapshots with English language. After some snapshots the users decided to switch the UI (or OS) language to something else and do some more snapshots with the same profile.
Then it is not possible to "decode" the old snapshot logs written in English?

It seems to me that we shouldn't touch the source string _('Take snapshot)`. Correct? 😄

@Germar
Copy link
Member

Germar commented Nov 9, 2023

Do we talk about this string?

Correct!

Do I understand that correct? Someone create encfs snapshots with English language. After some snapshots the users decided to switch the UI (or OS) language to something else and do some more snapshots with the same profile.
Then it is not possible to "decode" the old snapshot logs written in English?

Yes, that's correct. But not just because someone changed his locale, this will also happen if the translation of that string changes

It seems to me that we shouldn't touch the source string _('Take snapshot)`. Correct? 😄

I would recommend to not change it. Also changing translation should be handled with care.

It would be better to not translate that string at all and create a regex with every possible translation for backwards compatibility

@buhtz
Copy link
Member Author

buhtz commented Nov 9, 2023

It would be better to not translate that string at all and create a regex with every possible translation for backwards compatibility

Can't we just modify the regex that way that it says "any string" at this part of the string?
Is there a risk for a false positive?

Just checking for a "pattern" (my pseudo code) like this seems to be enough

[I] * (rsync: *

@Germar
Copy link
Member

Germar commented Nov 9, 2023

Can't we just modify the regex that way that it says "any string" at this part of the string?

🤔 you're right. Sometimes I'm too complicated 🙄
The log is written by this

self.setTakeSnapshotMessage(
0, _('Take snapshot') + " (rsync: %s)" % line)

Just make sure to use non-greedy regex

@buhtz
Copy link
Member Author

buhtz commented Nov 11, 2023

Because of #1549 I wouldn't work further and wouldn't modify the regex. The code es related to EncFS.

Before modifying the regex I would need a unit test to make sure I don't accidentally modify behavior.
But this is to much work for code that will soon get replaced or removed.

@buhtz buhtz closed this as completed Nov 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion decision or consensus needed EncFS using the EncFS file system
Projects
None yet
Development

No branches or pull requests

2 participants