vaeth / logclean

Keep only compressed logs of installed packages (for Gentoo's portage system)
http://www.mathematik.uni-wuerzburg.de/~vaeth/gentoo/index.html#logclean
5 stars 0 forks source link

Do not execute logclean in case the options contain an error #4

Closed equaeghe closed 4 years ago

equaeghe commented 4 years ago

I executed logclean -c -s logs instead of logclean -c '' -s logs and unintentionally, all my logs were cleaned. I would like to suggest to first check the options for errors and aborting when they contain errors.

Furthermore, no logfiles were retained, not even the most recent one for installed packages. (Only those for logclean and its dependencies.) As far as I could gather, no time-based cleaning should be done by default.

vaeth commented 4 years ago

I understand that the typo was particularly bad here. However, I mark the issue as "Can't fix", because actually all options which are trivial to check are already checked. To check the validity of the -c argument (which in the example is "-s") is not trivial, and I will not implement it: It requires a dependency to perl's File-Which package (or re-implemention of that package which would be hackish) which IMHO is not acceptable only for a pre-check.

I hope that the loss was not too bad (except for some error messages when attempting to call the (hopefully nonexistent!) binary -s, the effect should probably have been similar to logclean -c '' logs).

I can only give the general recommendation to always pass "dry-run"-type arguments first on the command line (also in case a program is really buggy and already does something when evaluating the arguments, usually in-order)

equaeghe commented 4 years ago

I hope that the loss was not too bad (except for some error messages when attempting to call the (hopefully nonexistent!) binary -s, the effect should probably have been similar to logclean -c '' logs).

I realized soon after creating the issue that I had btrfs snapshots to retrieve everything from. So no, it wasn't bad in the end. (It wouldn't ever have been problematic.)