Bug 260746 - devel/git: Command 'git maintenance start' fails with 'file name must be specified for replace'
Summary: devel/git: Command 'git maintenance start' fails with 'file name must be spec...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Renato Botelho
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-28 04:59 UTC by Mark Waite
Modified: 2022-08-29 10:51 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Waite 2021-12-28 04:59:40 UTC
Beginning with git 2.30.0, the 'maintenance' command has been added.  It allows a user to schedule regular updates in a git repository using the system scheduler.

The command 'git maintenance start' schedules periodic execution of repository updates.  Unfortunately, when I use that command with git 2.34.1 on FreeBSD 12.3-RELEASE and FreeBSD 13.0-RELEASE-p5, it reports the error:

crontab: no crontab for mwaite
crontab: usage error: file name must be specified for replace
usage: crontab [-u user] file
       crontab [-u user] { -l | -r [-f] | -e }
error: 'crontab' died

The commands to duplicate the problem are:

$ TMPDIR=`mktemp -d`
$ cd $TMPDIR
$ git clone https://github.com/jenkinsci/elastic-axis-plugin.git
$ cd elastic-axis-plugin
$ git maintenance start
Comment 1 commit-hook freebsd_committer freebsd_triage 2022-08-29 10:50:21 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=82c314474fce8cd4a9ea5cc95d0ca4f6165e6acc

commit 82c314474fce8cd4a9ea5cc95d0ca4f6165e6acc
Author:     Renato Botelho <garga@FreeBSD.org>
AuthorDate: 2022-08-29 10:15:42 +0000
Commit:     Renato Botelho <garga@FreeBSD.org>
CommitDate: 2022-08-29 10:49:23 +0000

    devel/git: Fix 'git maintenance start'

    Add a patch from upstream to fix 'git maintenance start'.  Here follow
    upstream commit message:

    While cron is specified by POSIX, there are a wide variety of
    implementations in use.  On FreeBSD, the cron implementation requires a
    file name argument: if the user wants to edit standard input, they must
    specify "-".  However, this notation is not specified by POSIX, allowing
    the possibility that making such a change may break other, less common
    implementations.

    Since POSIX tells us that cron must accept a file name argument, let's
    solve this problem by specifying a temporary file instead.  This will
    ensure that we work with the vast majority of implementations.

    Note that because delete_tempfile closes the file for us, we should not
    call fclose here on the handle, since doing so will introduce a double
    free.

    PR:             260746
    Reported by:    Mark Waite <mark.earl.waite@gmail.com>
    Obtained from:  https://lore.kernel.org/git/1dd29f43-1a8e-eb69-3320-7f5140a0e18e@github.com/T/#me47087c1f9034c82da8eae83db18cc6114c2c1e5
    Sponsored by:   Rubicon Communications, LLC ("Netgate")

 devel/git/Makefile                               |   1 +
 devel/git/files/patch-fix-maintenance.diff (new) | 112 +++++++++++++++++++++++
 2 files changed, 113 insertions(+)
Comment 2 Renato Botelho freebsd_committer freebsd_triage 2022-08-29 10:51:01 UTC
Patch from upstream is now applied on ports tree.  Package version 2.37.2_1 is fixed.

Thanks!