git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] maintenance: trace when auto maintenance skips due to lock

From
Pushkar Singh <pushkarkumarsingh1970@gmail.com>
Date
Nov 2, 2026, 12:23 UTC
Message-ID
<CALE2CrSNCpjLJcfqU6=qwQZbWwV4Vn5bgfEmp8piCy7CR3JxOA@mail.gmail.com>
In-Reply-To
<auhJ0B_1__9z3DEC@pks.im>
[snip]
Show 5 quoted lines
> So we now know to report failure when the lock exists already, but in
> any other case we don't log anything at all. But wouldn't the caller
> want to know when we failed because of for example EPERM, too, or
> because of any other error?
>

At first I only considered EEXIST, but you're right, we should be reporting other lock acquisition failures too. I've included the actual reason in the Trace2 event.

Show 14 quoted lines
> >               if (!opts->auto_flag && !opts->quiet)
> >                       warning(_("lock file '%s' exists, skipping maintenance"),
> >                               lock_path);
>
> It's quite curious that we only print a warning when `git maintenance
> run` has failed to acquire the lock instead of bubbling up an error. I
> would have expected that we:
>
>   - Exit successfully but print a warning in the case where we are
>     executed with "--auto".
>
>   - Exit with an error code and print an error in the case where we
>     execute without "--auto".
>

Agreed. The current behavior for manual invocations is a bit odd, especially since we end up returning success even though we couldn't acquire the lock.

[snip]
> This is of course outside the scope of your patch series, but if you
> feel like it I think it could be easily fixed while at it in a second
> patch.
>

I was thinking of including this in the same patch series since both changes are around the same lock acquisition path. I've included this in the v2 as well, so manual invocations now report an error and return a non-zero status, while --auto still exits successfully but prints a warning.

Thanks for the review :-)
Pushkar
Previous: Patrick SteinhardtNext: Pushkar Singh
Message 3 of 10 in “maintenance: trace when auto maintenance skips due to lock”
  1. maintenance: trace when auto maintenance skips due to lockPushkar Singh, Nov 1, 2026
  2. Patrick SteinhardtNov 2, 2026
  3. Pushkar SinghNov 2, 2026
  4. maintenance: improve handling of lock acquisition failuresPushkar Singh, Nov 2, 2026
  5. Patrick SteinhardtNov 2, 2026
  6. Pushkar SinghNov 3, 2026
  7. 0/2 maintenance: improve lock acquisition failure handlingPushkar Singh, Nov 4, 2026
  8. 1/2 maintenance: report lock acquisition failuresPushkar Singh, Nov 4, 2026
  9. 2/2 maintenance: trace lock acquisition failuresPushkar Singh, Nov 4, 2026
  10. Aniket GuptaNov 4, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.