From: Johannes Sixt <j6t@kdbg.org>
To: chib <chib@foxmail.com>
Cc: chib via GitGitGadget <gitgitgadget@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] git-gui: drain the cat-file pipe before closing it
Date: Thu, 3 Sep 2026 19:49:40 +0200 [thread overview]
Message-ID: <51211bf8-caa6-4aa4-82fd-c80d9b378ea7@kdbg.org> (raw)
In-Reply-To: <pull.2216.git.1788452262806.gitgitgadget@gmail.com>
Am 03.09.26 um 18:17 schrieb chib via GitGitGadget:
> From: chib <chib@foxmail.com>
>
> commit_committree opens "git cat-file commit <parent>" to read the tree
> line for the empty-commit check, reads only the first line, and then
> closes the pipe while the rest of the commit object (often several
> kilobytes of commit message) is still unread.
>
> On Linux this is harmless: the child process dies of SIGPIPE when it
> keeps writing, and that is not reported as an error when the pipe is
> closed. On Windows there is no SIGPIPE: the native git.exe gets a
> broken-pipe error when writing and exits with a non-zero status. Tcl's
> [close] then surfaces that as "child process exited abnormally", the
> commit is aborted, and the index lock is released with nothing
> committed. The failure only shows up once the parent commit's object is
> larger than the pipe buffer: in testing with Git for Windows 2.52,
> objects up to ~6.5 KiB always succeed while objects of ~9 KiB and up
> fail 10 out of 10 times (the threshold is around the 8 KiB pipe
> buffer). Amending a commit with a long message therefore triggers it
> reliably while short commits slip through.
Nicely analyzed. While this all sounds sensible, I am unable to
reproduce the failure on Windows. (But I use my own build, not Git for
Windows.) I made a tiny change, then inserted a lot of text in the
commit message field (18k), and committed. Then I clicked "Amend Last
Commit", changed the commit message slightly, and committed again. No
error. Do you have instructions how to reproduce the failure?
> Reading the pipe to EOF
> before closing fixes it 10 out of 10 times, and is harmless on POSIX
> platforms where the same test succeeds either way.
>
> Read the rest of the pipe before closing it, mirroring what the amend
> path already does when loading the parent commit's message.
You can't compare this case with the "amend" case, because "amend" needs
the commit message. The usual way to stop that 'close' complains is to
wrap it in a 'catch'.
> Signed-off-by: chib <chib@foxmail.com>
Please use your full name as author and to sign off, not a nick name.
-- Hannes
prev parent reply other threads:[~2026-09-03 18:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 16:17 [PATCH] git-gui: drain the cat-file pipe before closing it chib via GitGitGadget
2026-09-03 17:49 ` Johannes Sixt [this message]
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=51211bf8-caa6-4aa4-82fd-c80d9b378ea7@kdbg.org \
--to=j6t@kdbg.org \
--cc=chib@foxmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@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