Repository navigation
Conversation
create_snapshot_for_tags() logged "Failed to create snapshot" when create_snapshot_with_btrfs() or create_snapshot_with_rsync() returned no snapshot, but still returned true. So `timeshift --create` and the scheduled `timeshift --check` exited with status 0 although no snapshot was created (for example when btrfs refuses to snapshot a subvolume with an active swap file), and the window said "Snapshot Created" instead of "Snapshot Created With Errors". Return false in this case, like the other error paths of the function. create_snapshot() now returns before repo.auto_remove(), which used to delete the empty snapshot directory of the failed attempt as an invalid snapshot. So delete it right away when btrfs fails, otherwise every failed scheduled run would leave an empty directory behind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Create: Report an error when the snapshot fails
timeshift --createand the scheduledtimeshift --checkexit with status 0 when the snapshot fails.create_snapshot_for_tags()logs "Failed to create snapshot" but still returns true whencreate_snapshot_with_btrfs()orcreate_snapshot_with_rsync()returns no snapshot, and the window says "Snapshot Created".To reproduce on BTRFS, activate a swap file in the root subvolume (btrfs refuses to snapshot it):
This PR returns false in that case, like the other error paths of the function:
--createexits with 1,--checklogs "Daily snapshot failed!" and exits with 1, and the window shows "Snapshot Created With Errors" (it still closes after a second; the desktop notification "Failed to create snapshot" stays).Because
create_snapshot()now returns beforerepo.auto_remove(), which used to delete the empty directory of the failed attempt as an invalid snapshot, the directory is deleted right away when btrfs fails. Otherwise every failed scheduled run would leave an empty directory intimeshift-btrfs/snapshots.Scripts that run
timeshift --createbefore a package operation and stop when it fails (e.g. timeshift-autosnap-apt) now stop the package operation when the snapshot fails; until now they always continued.Tested in a Linux Mint 22.3 VM (BTRFS): exit status 1 after failed on-demand and scheduled snapshots, 0 after successful ones, no leftover directories.