git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Derrick Stolee <stolee@gmail.com>
Cc: git@vger.kernel.org, Shubham Kanodia <shubham.kanodia10@gmail.com>
Subject: Re: [PATCH] builtin/gc: fix crash when running `git maintenance start`
Date: Wed, 9 Oct 2024 08:28:40 +0200	[thread overview]
Message-ID: <ZwYij4t5eDgy23iw@pks.im> (raw)
In-Reply-To: <b4d75b35-bfe2-4950-b2de-b56d95918b3c@gmail.com>

On Tue, Oct 08, 2024 at 10:58:06PM -0400, Derrick Stolee wrote:
> On 10/8/24 2:30 PM, Derrick Stolee wrote:
> > On 10/8/24 8:15 AM, Patrick Steinhardt wrote:
> > > It was reported on the mailing list that running `git maintenance start`
> > > immediately segfaults starting with b6c3f8e12c (builtin/maintenance: fix
> > > leak in `get_schedule_cmd()`, 2024-09-26). And indeed, this segfault is
> > > trivial to reproduce up to a point where one is scratching their head
> > > why we didn't catch this regression in our test suite.
> > 
> > > +test_expect_success 'start without GIT_TEST_MAINT_SCHEDULER' '
> > > +    test_when_finished "rm -rf crontab.log script repo" &&
> > > +    mkdir script &&
> > > +    write_script script/crontab <<-EOF &&
> > > +    echo "\$*" >>"$(pwd)"/crontab.log
> > > +    EOF
> > > +    git init repo &&
> > > +    (
> > > +        cd repo &&
> > > +        sane_unset GIT_TEST_MAINT_SCHEDULER &&
> > > +        PATH="$(pwd)/../script:$PATH" git maintenance start --scheduler=crontab
> > > +    ) &&
> > > +    test_grep -- -l crontab.log &&
> > > +    test_grep -- git_cron_edit_tmp crontab.log
> > > +'
> > > +
> > I see why we didn't catch this immediately. This is a good way to work
> > around this issue of "mocking" the scheduler.
> 
> Unfortunately, this test is broken on macOS and Windows. Those platforms will
> fail when asked for 'crontab' without the test variable.
> 
> Here is a potential fixup that will make your test succeed:

Oh, indeed, thanks for flagging this. The issue is that those platforms
do not make `crontab` available at all.

I think we can land at a better fix though: the systemctl-based
scheduler _is_ available on all platforms if the systemctl binary is
found. So let me adapt the script accordingly.

Patrick

  reply	other threads:[~2024-10-09  6:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-08 10:50 Bug: `git maintenance start` is likely broken in 2.47 Shubham Kanodia
2024-10-08 11:45 ` Patrick Steinhardt
2024-10-08 12:15 ` [PATCH] builtin/gc: fix crash when running `git maintenance start` Patrick Steinhardt
2024-10-08 18:30   ` Derrick Stolee
2024-10-09  2:58     ` Derrick Stolee
2024-10-09  6:28       ` Patrick Steinhardt [this message]
2024-10-08 18:33   ` Junio C Hamano
2024-10-09 23:14     ` Junio C Hamano
2024-10-10  4:54       ` Patrick Steinhardt
2024-10-10  5:10         ` Patrick Steinhardt
2024-10-09  7:08 ` [PATCH v2] " Patrick Steinhardt
2024-10-09 13:13   ` Derrick Stolee
2024-10-09 17:28     ` Junio C Hamano
2024-10-09 17:10   ` Junio C Hamano
2024-10-10  5:33 ` [PATCH v3] " Patrick Steinhardt
2024-10-10 17:09   ` Junio C Hamano
2024-10-14  4:44     ` Shubham Kanodia
2024-10-14  8:38       ` Patrick Steinhardt
2024-10-15  0:36         ` Taylor Blau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZwYij4t5eDgy23iw@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=shubham.kanodia10@gmail.com \
    --cc=stolee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).