Re: crontab(1) using stdin

наб <[email protected]>
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <ljhzqcqk5my5o7xjgnepl7fwhg6zu5qji4piseacuwzxwhfujj@tarta.nabijaczleweli.xyz>
On Thu, Oct 31, 2024 at 12:35:01AM +0100, Steffen Nurpmeso wrote:
> наб wrote in
>  <q2pxxf2jv42trd53f3vu6n6656i2oxsne4p4pefirzq52mru7j@tarta.nabijaczleweli\
>  .xyz>:
>  |You can still write this portably:
>  |  echo crontab > ./-
>  |  crontab - < -
>  |  rm -
>  |unideal, sure, but.
> OpenIndiana says
>   #?1|oi-2024:steffen$ crontab -
>   crontab: can't open your crontab file.
Regardless of the school this subscribes to it should work.

I tried to install openindiana to test but the images don't work,
but if it's similar to the illumos gate crontab then I don't see why it
wouldn't
        } else {
                if (argc == 0)
                        copycron(stdin);
                else if (seteuid(getuid()) != 0 || (fp = fopen(argv[0], "r"))
                    == NULL)
                        crabort(BADOPEN);
                else {
                        seteuid(0);
                        copycron(fp);
                }
        }
(BADOPEN is "can't open your crontab file.")

Beside something funny like, say, special - handling?
But unclear why the fopen would fail then or what it'd be.
What about... "crontab -- - < -"?
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEfWlHToQCjFzAxEFjvP0LAY0mWPEFAmcizc4ACgkQvP0LAY0m
WPEFPBAAgMhW6l751SCTqxeiTyNeKvAjQdGDc2osum9EeoGqRG8hb3O5Rjw9eUgM
RCAkcR3NejjQqQ7ChEkvOZNWryz81umYhgOzqFrAsnAZCLzNjdn0LJ16oCHTx8NX
myavhQT8sjqTTFlLR3NyHK6WRVcc+hVd9OQ4FdPqd20ZGZaBu5jBaBi8UnfhAjyS
wuegKMQcw+bf/qLGlqjL7MyLJTADSQwwYOWKl86FLzVSAWhCnb3hOCwxiwuoZHdS
Kjp1zmuVctdstmUBXGkLDC61z9f8pynGnKvW6qnkiHICQHVVDy0lqTVMyP3opGGz
t/Nbb8hmIxOr13bIqofzcBAY9AwfIVjMXQPf+epEH6RTWjDGx9BdqVHx+fCMkTAv
CKARH3fefkD51ExIfKmaCgytUFOy8xCQxD7Ojx+PH19jegFhPUig40Wb5eduMpzs
Xyx+SFSwRv6jpD0mkT7Q2txbEncivv3u43mKyRGRjkUCA3ql5dH+0aFQYHgmhA1j
hwxNeKHoB5L0+Nf9LKvCNph8jN1K9NQz2wTx9dVIBvfyTDEPy0UYwkRwOLQy9h4Q
f0af0wBpjqfCg3EU896UK412DjAJBxSffdCu738gfdy0C1xUSeozTUuhGwmK07L5
kk4Zm4luXneHhUT0RJ4meO33pa1C5p+mdS+OcQNvGShNDdj+VCM=
=gAc9
-----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.