kimono-koans / httm

Interactive, file-level Time Machine-like tool for ZFS/btrfs/nilfs2 (and even Time Machine and Restic backups!)
https://crates.io/crates/httm
Mozilla Public License 2.0
1.35k stars 29 forks source link

Fallback support to find snapshots from defined directory #120

Closed nakamuray closed 3 months ago

nakamuray commented 4 months ago

Is your feature request related to a problem? Please describe. I'm using btrfs/snapper with config SYNC_ACL="yes", which make .snapshots directory readable for my regular user account. But httm still require root privilege to list snapshots because my user can't call btrfs subvolume show command.

Describe the solution you'd like Fallback to from_defined_mounts(...) path to find snapshots if user don't have root privilege. On my situation, this code path works and httm lists snapshots. (I'm using httm with a modification that always use this code path and it seems to work.)

Describe alternatives you've considered Alternatively, if httm has command line option to tell it to use that code path, I could use it to get snapshots.

Additional context

kimono-koans commented 4 months ago

Fallback to from_defined_mounts(...) path to find snapshots if user don't have root privilege.

In principle, I don't have a problem doing this, but let me work up a branch and make sure it doesn't complicate anything else.

The only issue I can imagine is this makes error handling more confusing. Like -- you're using btrfs, and httm isn't working. Why? Well, maybe we've skipped all the error messages/paths to fallback to something else. So -- the solution is may be to continue printing an error message which indicates some fallback behavior, but only if Snapper mounts are detected.

I'll take a look.

kimono-koans commented 3 months ago

You can try this branch with: cargo install --locked --git https://github.com/kimono-koans/httm.git --branch fallback_to_defined_mounts

Pleased to know your thoughts. Thanks!

kimono-koans commented 3 months ago

https://github.com/kimono-koans/httm/pull/122

nakamuray commented 3 months ago

Thanks. I've tried the branch and works as expected.