MilesCranmer / rip2

A safe and ergonomic alternative to rm
GNU General Public License v3.0
27 stars 1 forks source link

weird seance stuff #18

Closed JeromeSchmied closed 2 months ago

JeromeSchmied commented 2 months ago
~/Downloads> rip uu_meta.zip
About to copy a big file (/home/jero/Downloads/uu_meta.zip is 1618 MB)
Permanently delete this file instead? (y/N)
# hit `Return` -> buried

~/Downloads> rip gnu_meta.zip -i
gnu_meta.zip: file, 1618 MB
> PK
Send gnu_meta.zip to the graveyard? (y/N) ^C
# hit `Ctrl-c` -> cancelled

~/Downloads[130]> rip gnu_meta.zip
About to copy a big file (/home/jero/Downloads/gnu_meta.zip is 1618 MB)
Permanently delete this file instead? (y/N) y
# hit `y` -> permanently deleted

~/Downloads> rip -s
/tmp/graveyard-jero/home/jero/Downloads/uu_meta.zip
/tmp/graveyard-jero/home/jero/Downloads/gnu_meta.zip # this should NOT be here, as it was permanently deleted, not buried
# listed files buried from `~/Downloads`

~/Downloads> rip -su
About to copy a big file (/tmp/graveyard-jero/home/jero/Downloads/uu_meta.zip is 1618 MB)
Permanently delete this file instead? (y/N) # I mean, what's the question, I want to restore this file and I won't permanently delete instead right?
Returned /tmp/graveyard-jero/home/jero/Downloads/uu_meta.zip to /home/jero/Downloads/uu_meta.zip
Exception: Unbury failed: couldn't copy files from /tmp/graveyard-jero/home/jero/Downloads/gnu_meta.zip to /home/jero/Downloads/gnu_meta.zip # didn't exist, as it was permanently deleted
# exited with 1

So issues:

  1. if file is permanently deleted, it doesn't exist -> don't move to /tmp/graveyard-user/file
  2. if big_file was buried, it's being restored with rip -su big_file -> don't ask whether big_file should be permanently deleted instead of restoration
MilesCranmer commented 2 months ago

Nice find, thanks for documenting this! Will get a patch up later today.

JeromeSchmied commented 2 months ago

wow, great!

MilesCranmer commented 2 months ago

Okay I fixed it in https://github.com/MilesCranmer/rip2/pull/20. Also added a unit-test for this behavior.