Anonymous | Login | 2024-11-13 16:25 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
ID | Category | Severity | Type | Date Submitted | Last Update | ||||||||
0001866 | [1003.1(2024)/Issue8] Shell and Utilities | Editorial | Enhancement Request | 2024-10-31 00:28 | 2024-10-31 22:10 | ||||||||
Reporter | steffen | View Status | public | ||||||||||
Assigned To | |||||||||||||
Priority | normal | Resolution | Accepted As Marked | ||||||||||
Status | Resolved | ||||||||||||
Name | steffen | ||||||||||||
Organization | |||||||||||||
User Reference | |||||||||||||
Section | crontab | ||||||||||||
Page Number | 2749 ff. | ||||||||||||
Line Number | 90909 ff. | ||||||||||||
Interp Status | --- | ||||||||||||
Final Accepted Text | Note: 0006943 | ||||||||||||
Summary | 0001866: crontab: does not support Utility Syntax Guideline 13 | ||||||||||||
Description |
On a NetBSD i stumbled over an experienced user failing to write portable crontab scripts because POSIX crontab does not support guideline 13 which says: For utilities that use operands to represent files to be opened for either reading or writing, the '−' operand should be used to mean only standard input (or standard output when it is clear from context that an output file is being specified) or a file named −. Looking around we see: <code> # dcron (Linux plus) $ crontab --help crontab 4.5 crontab file [-u user] replace crontab from file crontab - [-u user] replace crontab from stdin ... # busybox $ busybox.static crontab --help BusyBox v1.37.0.git (2024-04-20 23:25:28 CEST) multi-call binary. Usage: crontab [-c DIR] [-u USER] [-ler]|[FILE] ... FILE Replace crontab by FILE ('-': stdin) # OpenBSD #?128|kent:open-src.git$ git show origin/master:usr.sbin/cron/crontab.1|mandoc|v crontab [-u user] file crontab [-e | -l | -r] [-u user] The first form of this command is used to install a new crontab from some named file, or standard input if the pseudo-filename ‘-’ is given. # NetBSD #?0|kent:net-src.git$ git show origin/trunk:external/bsd/cron/dist/crontab.1|mandoc|v crontab [-u user] crontab [-elr] # The first form of this command is used to install a new crontab from some named file or standard input if the pseudo-filename “-” is given. # FreeBSD #?128|kent:free-src.git$ git show origin/main:usr.sbin/cron/crontab/crontab.1|mandoc|v crontab [-u user] file crontab [-u user] { -l | -r [-f] | -e } The first form of this command is used to install a new crontab from some named file or standard input if the pseudo-filename ‘-’ is given. # (ditto DragonFlyBSD) </code> So that looks good. Solaris aka OpenIndiana 2024 not: <code> #?0|oi-2024:steffen$ crontab ^C#?1|oi-2024:steffen$ crontab - crontab: can't open your crontab file. </code> But implementation should be trivial i would think. (Or replacing with dcrond.) |
||||||||||||
Desired Action | Please support Utility Syntax Guideline for crontab. | ||||||||||||
Tags | tc1-2024 | ||||||||||||
Attached Files | |||||||||||||
|
Notes | |
(0006939) steffen (reporter) 2024-10-31 00:29 |
The desired action should be edited to include the number 13, of course. Sorry. |
(0006940) jclulow (reporter) 2024-10-31 09:44 |
Note that crontab(1) on illumos systems (and presumably we inherited this from Solaris) already reads from stdin if no filename argument is provided. https://illumos.org/man/1/crontab [^] "If invoked without options, crontab copies the specified file, or the standard input if no file is specified, into a directory that holds all users' crontabs." |
(0006941) geoffclare (manager) 2024-10-31 10:05 |
> ^C#?1|oi-2024:steffen$ crontab - > crontab: can't open your crontab file. It is trying to open a file named '-', same as on Solaris 11.4: $ crontab - crontab: can't open your crontab file. $ touch ./- $ crontab - $ echo $? 0 This is allowed by Guideline 13, which crontab is already required to conform to. The portable way to use stdin is to omit the file operand. |
(0006943) geoffclare (manager) 2024-10-31 10:34 |
There is a minor related problem which we could fix via this bug, which is that the STDIN section is missing the usual boilerplate relating to guideline 13. The following is based on grep... On page 2750 line 90949 section crontab (STDIN), change: See the INPUT FILES section.to: The standard input shall be used if no file operand is specified, and shall be used if the file operand is '−' and the implementation treats the '−' as meaning standard input. Otherwise, the standard input shall not be used. See the INPUT FILES section. |
(0006947) steffen (reporter) 2024-10-31 22:10 |
jclulow: thank you. Note Geoff Clare seems to listen to NetBSD, there another POSIX contributor had one of his smart ideas before and posted <code> > |You can still write this portably: > | echo crontab > ./- > | crontab - < - > | rm - > |unideal, sure, but. </code> So if accepted it may become part of compliance test. |
Issue History | |||
Date Modified | Username | Field | Change |
2024-10-31 00:28 | steffen | New Issue | |
2024-10-31 00:28 | steffen | Name | => steffen |
2024-10-31 00:28 | steffen | Section | => crontab |
2024-10-31 00:28 | steffen | Page Number | => 2749 ff. |
2024-10-31 00:28 | steffen | Line Number | => 90909 ff. |
2024-10-31 00:29 | steffen | Note Added: 0006939 | |
2024-10-31 09:44 | jclulow | Note Added: 0006940 | |
2024-10-31 10:05 | geoffclare | Note Added: 0006941 | |
2024-10-31 10:34 | geoffclare | Note Added: 0006943 | |
2024-10-31 15:19 | geoffclare | Interp Status | => --- |
2024-10-31 15:19 | geoffclare | Final Accepted Text | => Note: 0006943 |
2024-10-31 15:19 | geoffclare | Status | New => Resolved |
2024-10-31 15:19 | geoffclare | Resolution | Open => Accepted As Marked |
2024-10-31 15:20 | geoffclare | Tag Attached: tc1-2024 | |
2024-10-31 22:10 | steffen | Note Added: 0006947 |
Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |