-
Notifications
You must be signed in to change notification settings - Fork 17
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
crontab -r deletes crontab without warning. #26
Comments
On Friday, July 5, 2024 1:57:51 AM PDT Stavros Korokithakis wrote:
Deleting a crontab without any warning at all when a user mistypes the most
commonly used command (`crontab -e`) as the letter next to that is...
unwise. Adding a prompt to confirm deletion, or making a backup, would save
a few crontabs.
thanks. cron's interface follows posix. in the old days it was -d not -r, and
i did have a verification prompt. we can't break shell scripts that depend on
the posix behaviour. suggestions welcomed.
…--
P Vixie
|
Would it be acceptable to create a backup somewhere, to enable the user to undo the deletion? What's the use case for deleting a crontab? I've always just cleaned the lines by hand, so I'm not sure how people use |
On Friday, July 5, 2024 11:22:35 AM PDT Stavros Korokithakis wrote:
Would it be acceptable to create a backup somewhere, to enable the user to
undo the deletion?
keeping in mind that /var/cron/tabs (or /var/spool/cron on older systems) is
usually mode 700 and owned by root:root, we would need to preserve that level
of reachability in any change. that is, "ls" by a non-root user can't display
a set of user names who have crontabs, or who have backups. this argues for
adding /var/cron/tabs/.backups (or /usr/spool/cron/.backups) or similar -- and
it would have to be created by the sysadmin not by the crontab command "on
demand". would that solve any problems or simply add more confusion?
What's the use case for deleting a crontab? I've always just cleaned the
lines by hand, so I'm not sure how people use `-r`.
this version of cron, or derivatives it, are now universal. there's no
telemetry by which we could answer your "-r" question but the law of large
numbers indicates that some workflows depend on every feature cron has.
…--
P Vixie
|
Well, given that I've been a Linux user for more than twenty years and I only discovered the I agree that crontab is so widely used that it's basically ossified and very few changes are possible, but the footgun of one letter being "edit, the thing you do multiple times a day" and the letter next to it being "say goodbye to your data" means I'll never be comfortable typing By the way, which part of POSIX is this behavior defined in? I don't remember offhand any other utility where -r deletes data like this... |
Shell scripts doesn't run in tty most of the time. It can if someone want to test a script. In that case the message could be: It is the same heuristics used by git, xxd, grep, ... when choosing to emit colors. |
Deleting a crontab without any warning at all when a user mistypes the most commonly used command (
crontab -e
) as the letter next to that is... unwise. Adding a prompt to confirm deletion, or making a backup, would save a few crontabs.The text was updated successfully, but these errors were encountered: