Re: crontab(1) using stdin

наб <[email protected]>
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <qansbvp5dnxfbogubbtsbaz6qkwqr2o4qt5uasrhsy7juqe7pi@tarta.nabijaczleweli.xyz>
On Tue, Oct 29, 2024 at 07:11:10PM +0100, Edgar Fuß wrote:
> > Those are not inconsistent, unless SUS specifies other behaviour for
> > the case of a bare -, or NetBSD's version doesn't read from stdin when
> > no (pseudo-)filename is given.
They are, POSIX says something like
  97851  STDIN
  97852  The standard input shall be used if a file operand is '−' and the implementation treats the '−'
  97853  as meaning standard input. Otherwise, the standard input shall not be used.
if it allows implementations to us - to mean stdin.

XCU crontab doesn't have this stanza.

> NetBSD's version complains if no filename is given.
POSIX.1-2024, XCU, crontab says:
  90910  SYNOPSIS
  90911  crontab [file]
  90911  crontab [-e|-l|-r]

  90913  DESCRIPTION
  90915                                                          The new crontab entry can be input by
  90916  specifying file or input from standard input if no file operand is specified, or by using an editor,
  90917  if −e is specified.

  90944  OPERANDS
  90945  The following operand shall be supported:
  90946  file The pathname of a file that contains specifications, in the format defined in the
  90947        INPUT FILES section, for crontab entries.

The standard is very clear that
"crontab"   means "crontab /dev/stdin" and
"crontab -" means "crontab ./-".

OTOH this fucking sucks, both ergonomically when you just nuked
your crontab by accident, and especially on implementations where "-"
does tend to mean the standard input stream.

Other implementations don't really agree with this, either:
sd-cron and the debian derivative of vixie-cron both have
"crontab" = "crontab -" = "crontab /dev/stdin".

If NetBSD "crontab" errors with 
"use crontab - to replace your crontab from the standard input stream"
then that's an improvement over both the standard and the status quo IMO
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEfWlHToQCjFzAxEFjvP0LAY0mWPEFAmch9IcACgkQvP0LAY0m
WPFBDQ/9Hax/7HF+IhnnZ3c9n+wns0jQkFSIT3fKY7UtP7osHpluw+FKhA2xxdQZ
rKJ81aWie6/NBTNCPalFF1PVBrMFhFw4qHuSsn4qSMOjQ7lmPfOKwY1Iz6w1+hsw
Y8CnRNNBvS/qnn4ACnubrcoa93OAlDMgMqnVIs7zMJ9nyV7lbEr6FkK+Q4Ta7l+G
7my+TdqYu0V+v2b31bLwVldAg6RMRxhaoms2TVReEvYWb6xoK/B3et6keZNAb21Y
zZAv2sMD4zgotxCTBbUhEHRoEVpFTeTi6ItSrwSSbWquc9O8Ps+pvBvOSglITIgc
zK1q4SJrCtvgbENtR2HHzDE8mYVDX8TlMRkhwN8TGRObHKTCK/C0G/q1Knuzi7cg
Fg3uv7iCKJComz9z7z83jPbDpXnuMdxp+/Gy9MT2R9Ik9fH2ilCjp/IyQU22tksF
wqfNdoOmSLKT/XHh97zYtzBBnmVtNvp9N8Vg24nDeN4fx3RWKclMchVJzkk2CtJ0
IfTbass2qjN0CXEOGs9jYRoOSlVUMvhUZr5PVsGK9D5uEFsw1O2/kPZe7VG13N8T
FBQc2S+i5xBDdploWx9X9Rog6rKlUmapz+iNXX5x+1ErEYsuTVYruKRCgzG5r3NF
CVOE0v5hin19RjNLJJUwF7uXUrWV0v9O3giRk4BeXWYfjIeUIvM=
=fC2e
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.