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

feat: Prefix temp snapshot copies with backintime_ #1940

Merged
merged 4 commits into from
Nov 27, 2024

Conversation

sevens
Copy link
Contributor

@sevens sevens commented Nov 21, 2024

I checked if it was easily possible to add a more specific prefix (e.g. backintime-snapshot_compare_ for when comparing snapshots) but the function gets used in 3 places (2 through calls to app.MainWindow.openPath()), all quite different use cases. Couldn't find a nice way to pass more specific info to tmpCopy() from them (don't know the code well enough to decide on a clean and good way to do this from all places, if it's even desirable at all).

Don't think this warrants a CHANGES entry?! Only case I can think of is if there are people who have e.g. some /tmp (and /var/tmp) cleanup scripts that assume the current format, but AFAICT it's nigh impossible to reliably determine if an old-format created dir is from BiT or not so that seems unlikely to exist to me.

Tested:

  • Compare 2 snapshots, it created temp dirs like /tmp/backintime_yvvem486_20241119-165907-278 (last 3 parts being snapshot id)
  • btnOpenCurrentItemClicked():
    • Navigate to file in snapshot that doesn't exist anymore on the local storage/source
    • Click Alt+Down (seems to be the only way to trigger this function)
    • Created temp dir: /tmp/backintime_esh5heni_20241121-112648-601/
  • filesViewItemActivated():
    • Navigate to file in snapshot that doesn't exist anymore on the local storage/source
    • Double-click on said file
    • Created temp dir: /tmp/backintime_ge543330_20241121-112648-601/

There don't seem to be any relevant unittests (same as for #1937).

See also: #1902 (comment) and #1902 (comment)

Back in Time will sometimes create a temp dir, to copy (parts of) a snapshot.
These have a generic name, in the form of `tmpXXXXXXXX_SNAPSHOTID`, where
`XXXXXXXX` are random characters and `SNAPSHOTID` is the snapshot id (e.g.
`20241121-112648-601`).  Only the latter gives a hint that these dirs are from
Back in Time but it's hard to tell as they're just some numbers.

This makes it tricky for the user to know if it's safe to delete these dirs if
they're left around (Back in Time will remove them if it exits cleanly but
that's not always possible, e.g. might hang if disk space gets full, like
in bit-team#1902 or when comparing too large snapshots).  Added an explicit
`backintime_` prefix to the temp dir to make their origin more clear.
@sevens
Copy link
Contributor Author

sevens commented Nov 21, 2024

I also tested changing the suffix code to:

sid = f'_profile_{sid.profileID}_snapshot_{sid.sid}'

but not sure if that's too verbose. Left it out of this PR for now, let me know if it should be added back... Example dir with this change: /tmp/backintime_ed3caw6l_profile_1_snapshot_20241119-170042-790

@sevens sevens marked this pull request as ready for review November 21, 2024 16:19
@buhtz buhtz self-assigned this Nov 21, 2024
@buhtz buhtz added this to the 1.6.0 (upcoming release) milestone Nov 21, 2024
@buhtz buhtz added PR: Waiting for review PR won't be merged until review and approval from a member of the maintenance team. HELP-WANTED Used by 24pullrequests.com to suggest issues labels Nov 21, 2024
@buhtz
Copy link
Member

buhtz commented Nov 22, 2024

Alt+Down is wired. 🤣 But won't change it today.
Thank you for testing and analyzing.

Ready to merge.

@buhtz buhtz added PR: Merge after creative-break Merge after creative-break (min. 1 week) and removed HELP-WANTED Used by 24pullrequests.com to suggest issues PR: Waiting for review PR won't be merged until review and approval from a member of the maintenance team. labels Nov 22, 2024
@buhtz buhtz merged commit e7ba17b into bit-team:dev Nov 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Merge after creative-break Merge after creative-break (min. 1 week)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants