-
Notifications
You must be signed in to change notification settings - Fork 78
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
Running "crontab" with no options runs "crontab /dev/stdin" #28
Comments
This stupid behavior is specified by POSIX, but let's see if anyone complains if we drop such error prone behavior. Fixed by 39a67fd |
This "stupid behaviour" (i. e. require crontab - instead of crontab to replace the user's scheduled commands) that was removed makes cronie incompatible with other applications that expect POSIX behavior, and I fail to see why incompatibilities need to be introduced just because users can't be bothered to read and understand the manual. A middle ground would be to use isatty() when crontab is called without arguments that prints something like |
I've implemented a different but IMO still sufficient middle ground of requiring the |
su username -c crontab -l
What this command does?
It does not list crontabs for username - for this it should be
su username -c "crontab -l"
. It runs "crontab" with no options.But what bare "crontab" command does? It's not documented - man page says at least one option or a single non-option argument is required. So I'd expect it to just fail with an error. But it runs an equivalent of "crontab /dev/stdin" instead, deleting the current crontab if stdin is empty. The "crontab -" also works like this (also undocumented in the man page).
The help showing when invalid option is given states "Default operation is replace, per 1003.2". I don't know the exact wording of the standard, but it does not seem to force this non-intuitive and dangerous behaviour. IMHO it just means that when the file argument is provided then the default operation is to replace the crontab with its contents.
The text was updated successfully, but these errors were encountered: