There are multiple crontab implementations that require stdin for editing a crontab to be explicitly specified as '-'. BusyBox crontab just shows usage when executed without arguments. [man 1 crontab][0] from openbsd states: > The pseudo-filename '-' must be specified to read from standard > input. Other implementations might not require it, but accept '-', so explicitly specify that crontab should read from stdin by passing the '-' pseudo-filename. [0]: https://www.unix.com/man-page/freebsd/1/crontab/ Signed-off-by: Kevin Daudt <me@xxxxxxxxx> --- The `git maintenance start` command is currently broken on the default alpine setup. This would fix it. I've tested `echo '* * * * * echo test' | crontab -` on the different platforms I have access to, and it worked without issues.. builtin/gc.c | 1 + t/helper/test-crontab.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin/gc.c b/builtin/gc.c index ef7226d7b..dfdb5bce9 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -1904,6 +1904,7 @@ static int crontab_update_schedule(int run_maintenance, int fd, const char *cmd) rewind(cron_list); strvec_split(&crontab_edit.args, cmd); + strvec_push(&crontab_edit.args, "-"); crontab_edit.in = -1; crontab_edit.git_cmd = 0; diff --git a/t/helper/test-crontab.c b/t/helper/test-crontab.c index e7c0137a4..525cb318a 100644 --- a/t/helper/test-crontab.c +++ b/t/helper/test-crontab.c @@ -17,7 +17,7 @@ int cmd__crontab(int argc, const char **argv) if (!from) return 0; to = stdout; - } else if (argc == 2) { + } else if ((argc == 3 && !strcmp(argv[2], "-")) || argc == 2) { from = stdin; to = fopen(argv[1], "w"); } else -- 2.30.1