Article View: linux.kernel.git
Article #2376Re: [PATCH 2/2] object-file: return error on index-pack abnormal exit
From: Junio C Hamano
Date: Wed, 04 Nov 2026 23:06
Date: Wed, 04 Nov 2026 23:06
79 lines
14975 bytes
14975 bytes
Justin Tobler <jltobler@gmail.com> writes:
> diff --git a/object-file.c b/object-file.c
> index a9800143bd..e04ce0bc11 100644
> --- a/object-file.c
> +++ b/object-file.c
> @@ -1429,8 +1429,7 @@ static int odb_transaction_files_write_pack(struct odb_transaction *base,
> struct pack_header hdr;
> const char *hdr_err;
> int err_fd = opts->err_fd;
> - int ret = -1;
> - int status;
> + int ret;
>
> hdr_err = parse_pack_header(&hdr, pack_fd);
> if (hdr_err) {
> @@ -1462,12 +1461,13 @@ static int odb_transaction_files_write_pack(struct odb_transaction *base,
> child.in = pack_fd;
> child.err = err_fd;
> child.git_cmd = 1;
> - status = run_command(&child);
> - if (status) {
> + if (run_command(&child)) {
> strbuf_addstr(err_msg, "unpack-objects abnormal exit");
> return -1;
> }
OK. A slight simplication that does not change any behaviour.
> } else {
> + int report_err;
> +
> strvec_pushl(&child.args, "index-pack", "--stdin", NULL);
> push_header_arg(&child.args, &hdr);
>
> @@ -1487,24 +1487,24 @@ static int odb_transaction_files_write_pack(struct odb_transaction *base,
> child.in = pack_fd;
> child.err = err_fd;
> child.git_cmd = 1;
> - status = start_command(&child);
> - if (status) {
> + if (start_command(&child)) {
> strbuf_addstr(err_msg, "index-pack fork failed");
> return -1;
> }
>
> - ret = read_index_pack_report(repo, child.out, &pack_name, NULL);
> + report_err = read_index_pack_report(repo, child.out, &pack_name, NULL);
>
> close(child.out);
>
> - status = finish_command(&child);
> - if (status) {
> + if (finish_command(&child)) {
> strbuf_addstr(err_msg, "index-pack abnormal exit");
> + ret = -1;
> goto out;
> }
OK. A slight simplication that does not change any behaviour again.
> - if (ret) {
> + if (report_err) {
> strbuf_addstr(err_msg, "index-pack failed to report pack name");
> + ret = -1;
> goto out;
> }
I guess this also does not change a behaviour? We used to relay the
error status returned by read_index_pack_report(), but now we force
the error code to an explicit -1.
Personally, I somehow find that the original "unless we positively
declare success, default to 'ret = -1', and if we may have detected
more specific error, return it back, and reset ret to 0 when we see
a success" easier to follow, but that may be subjective preference.
Will queue. Thanks.
Technical Details
Message-ID:
<xmqq8q38yz5i.fsf@gitster.g>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74501-linux-kernel-git=dewy.ruReferences:
<20261103212410.1389988-1-jltobler@gmail.com> <20261103212410.1389988-3-jltobler@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74501-linux-kernel-git=dewy.ru
From: gitster@pobox.com (Junio C Hamano)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH 2/2] object-file: return error on index-pack abnormal exit
Date: Wed, 04 Nov 2026 15:06:49 -0800
Organization: Usenet Network
Message-ID: <xmqq8q38yz5i.fsf@gitster.g>
References: <20261103212410.1389988-1-jltobler@gmail.com>
<20261103212410.1389988-3-jltobler@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: usenet.network;
logging-data="3527186"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:xc+W22FhGRX2sDSGiPVBqAXt5dA= sha256:Y3+IoIAWztKp6B6/9TiQzL9r/hOB/u2FX7q18HiLTz0=
sha1:JU7iFzgnF1CxpAYcNzOkxcvcoLk= sha256:9qQxn0YAvEasFCB2Ty6etWkfWhrKuHcBh8G1ZgLiliY=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 25ECA112E26; Thu, 5 Nov 2026 03:41:49 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.95
X-Spam-Status: No, score=-1.95 tagged_above=-9999 required=6.31
tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=pobox.com header.b=Z8DOh1NX; dkim=pass (2048-bit key)
header.d=messagingengine.com header.b=FKCCIqP8
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id TeXz8F4HKHDS;
Thu, 5 Nov 2026 03:41:45 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-74501-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=pobox.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id BD7F6112E19; Thu, 5 Nov 2026 03:41:31 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 8119D48CBC; Wed, 4 Nov 2026 23:07:50 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1793833613;
b=XwauGtGZqF/EdtZdq/QzLYScnLdr954iwhWtOau1wgF5v0yD+38lUiFLkYO8AVPu6DDs
hhY+9AUXgjeo/HDeherBLkuKQStWNfyaih6Td8JMmL8xVVqDGV1OhfpDoxTR9KCiqUfhA
kIxXQQS5gElDDv7WpP8qwlKMJsIxWiWYxKM3M4dds4nVISj+XiKfNXqWoVsNid9eme3JD
F+WHJ/qAptUgas2h1V5dPe3DlHTd5/T4itF5t27UTC4nfKgNHIun1Zu1qHv8Jog/A+i4q
muLVBazKpuUFN7/rBcvC9itsuacY4pnj9QNM6euKrB1/M0DIWSlJ5OZ+0zxhdIqsFwg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793833613;
h=X-Original-To:Received:DMARC-Filter:Received:Received:DKIM-Signature:
DKIM-Signature:X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:
Message-Instance:X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:
X-ME-Proxy:Feedback-ID:Received:From:To:Cc:Subject:In-Reply-To:
References:Date:Message-ID:User-Agent:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:Content-Type;
bh=mpWDozVD3KQZqgQMWf22vZ93TXf3TETFEGvaaVUsD4I=;
b=Py/dvz4pwAG/ycObKIB8zPq0/dCyuzMgdUpM0QzeiNNLyxMd8d81ohK3vE4gfc/3xxpv
/xLycHWBkQqlGr4Qjvb7TUg2hZX3qiczOP+z1GmzPixUhnPvKlNFfjYW5A6+xYaBmibnk
67x9TdjgW6cmSHMes82eCd1BzBiR0jztzJOPuIhIzrDhkm+6XHV+8T0txkb9zCiSblIwR
a4fniEAwwTHVyjSeSkYSc1apyt6eArGPxga6UpJoAwrns65DqESO787frI25zXPXFaF1u
N5kotqjq1eJI3WCJr4JyokkQLtyAeL7LuuaXn6YFpOK9mVgGYOU53EPze2SsX6X6ZEw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=Z8DOh1NX;
dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=FKCCIqP8;
dmarc=pass header.from=pobox.com;
spf=pass smtp.mailfrom=pobox.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 19E7A606A33E;
Wed, 4 Nov 2026 23:06:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=Z8DOh1NX;
dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=FKCCIqP8
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=103.168.172.149
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793833612;
b=RJWH1ajn/k6dIe9ISlkIz53xNJn9Ne25344W27joL0utPoIfWLdFo1OTpIAXmBXykicy
z/CwrFQHsb6wphCeDkffCYDSHj20oeeOhZSOjBoxvRjtmjsrOUPX+PHq5xwgv1miulKs/
LiwBeVAWW7C3dRNkrrsbjm6Rq0NB4UlMVY8SZ/dTHvNLwW7Ks7a5EenlD9FO0bKCU8arq
nt9joNklc0x3GdSsX8tAp6ZYs855W1WxGIQCXIa65Ux8iUwCcOtBYqCe9abZrIyhdTEpw
0YDumtgjEie27aD7C+aLYn6hg9859ksTcUxjucy1QgTZlkeEwwwKvfTOimY/QJdisKg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793833612;
h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature:
X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance:
X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID:
Received:From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
User-Agent:MIME-Version:Content-Type;
bh=mpWDozVD3KQZqgQMWf22vZ93TXf3TETFEGvaaVUsD4I=;
b=1ZfIsFY2WecU2gaD2i6t3K2ujukFFou9q1+HQt9KnfJuF0n2pF3bw1qj4q3NIVcDOgfJ
1FK7iGv3eW72OantFHaXNV2/hi/bwNQt2uH9CYnKEhjoYTwQ5R2DbPhPa9/VnUvCUhdZ7
9dQbvIOLXDucR9ndTcN2lwd5uVYgFpyo6i9iKj1fHsjYn777G+t6xROmIcGa4mBV4BjJt
Knw+UMu0iNxUw1586tsopjUkiqq9Mu+EOHviYy1AKogohXmD4gN9/0Zpyz2TstfBumq0D
C3TeEH+j/GZ0nUIU+FP2fw7AqO9pCjYqn+OV1H2GSxegEDLBWKXLLTtWPtbyBGCvAwQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=pobox.com;
spf=pass smtp.mailfrom=pobox.com;
dkim=pass header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=Z8DOh1NX;
dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=FKCCIqP8;
arc=none smtp.remote-ip=103.168.172.149
X-Received: from fout-a6-smtp.messagingengine.com (fout-a6-smtp.messagingengine.com [103.168.172.149])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA441606A326
for <git@vger.kernel.org>; Wed, 4 Nov 2026 23:06:51 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BA441606A326
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com
X-Received: from phl-compute-09.internal (phl-compute-09.internal [10.202.2.49])
by mailfout.phl.internal (Postfix) with ESMTP id F3909EC00F4
for <git@vger.kernel.org>; Wed, 4 Nov 2026 18:06:50 -0500 (EST)
X-Received: from phl-frontend-02 ([10.202.2.161])
by phl-compute-09.internal (MEProxy); Wed, 04 Nov 2026 18:06:50 -0500
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc
:cc:content-type:content-type:date:date:from:from:in-reply-to
:in-reply-to:message-id:mime-version:references:reply-to:subject
:subject:to:to; s=fm2; t=1793833610; x=1793920010; bh=mpWDozVD3K
QZqgQMWf22vZ93TXf3TETFEGvaaVUsD4I=; b=Z8DOh1NXCOtwmP/yU5x0OEyiP2
Sy4IAWgDXQfhwULE7nzPVtpdj62zH3UaWz/4vbFqCtB+ZQ8177+j6ViAmV8MHMro
1kDANQFdfA+JSiWBadmxraxlFf8KHy/KlRb+CUB5FIT5eWUvmg1qpB1WZn4pyKuP
oanTw3lnMYAM39Psf00tKIzezFd82upeORueGthcZ9cto2HDtg4SokJjPLYtcrd7
1+5ap1y4oT5dXJX8M5R8rVOo5PzqtsUOLWLPCBliYcCG15jJAiwi/VraOXf0cdnh
3zRtuhtb/9YD95GeYBcyQfwRDGhzJkpKKg1J6LqlsFIAHYn8XPDx5JWe6LxQ==
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-type:content-type:date:date
:feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
:message-id:mime-version:references:reply-to:subject:subject:to
:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=
1793833610; x=1793920010; bh=mpWDozVD3KQZqgQMWf22vZ93TXf3TETFEGv
aaVUsD4I=; b=FKCCIqP8MEoCbOHYoRUedIbUQmHSloZMazdk4zgU9nBznxmebxQ
BdDQZddQ63tXLJmQfURnXDw0PA59le0B8t1uI1ktKaKysNVyYp9fvy/JBIyfy+cR
lUs49+oH4N6UT7g89CKeJc4YEEftlLAtrP4nz6EXcQ6Mjhao0B+6g+o8EdSI2hGd
qTR/EIaJShXaa9jvUfkHe8jn3SdAwTjKsNHkDQ2Zxrh5QZbOIHnod/JUbPWff4vn
i0wE8BVl5w0Sth36v4zWDC6h0pp+2fPZYfOlSbJ5UKHkRMtvFf2/20Y2/0QJJ1UH
bnhytlLHpbfXLgG8n5dkhDJIQkSnjsMWDog==
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-08;
repo=github.com/dkim2wg/interop; date=2026-10-28; sw=lmtpprox;
action=sign d=pobox.com a=rsa-sha256;
X-DKIM2-Signature: i=1; m=1; t=1793833610; d=pobox.com;
mf=PGdpdHN0ZXJAcG9ib3guY29tPg==;
rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+;
s=fm2:rsa-sha256:WuLrgVo1ed8L8T0D+pnu7CcJQsn2eyxweO0joFq8Eu4Dyd4
v0EKjg+5wf5h29hdnO9GeLC/2hXvgQiMvOxhoTpQf//UhX6iyCfQ2DPnLln/ayOL
d+MegZhflcPT4TfqJRGsCvp8L+sGmptoUnc6O3tRaDgPAVCOTib8SdaiIq9xJIdh
MGX698Kil0mI9mIKaMCJwb2sSiQC6l44iWg2tL2qNq7heRYdmVEwMTHart23Fi1b
4Eh8iZzeQM+60R5jIdhSUpjHTobWTZ6lG08UB+GudPa115kOCVLOEEFljt67hnxF
gOGOD1Pwx2tR0fAfG5w637zrJL3GvaLoEF/IMJA==;
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-08;
repo=github.com/dkim2wg/interop; date=2026-10-28; sw=lmtpprox;
action=mi-m=1; hc=12;
hn=cc,content-type,date,feedback-id,from,in-reply-to,message-id,
mime-version,references,subject,to,user-agent;
X-Message-Instance: m=1; h=sha256:sUr81nYgZUcdtGFcKWN7VUMIHVMqIOlaRoXiepOvTe8=:zHqkScW1WZnQHbLF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w_EQLTvWwSExog4muXmLdMrhgxyIDOPinySTKA>
<xmx:irrrakLHQr19jtCujiC7Qa6nIQPoPUMO4w5pJAHC_R6ld4XiK-PRHg>
<xmx:irrrakSk3Yt7CDkWRvUSbMlHvh09W2RkzGoZsD_L4oOhmq_fmi9Rag>
<xmx:irrrasoSd4P4gIS4LKjAIbyuURjSTGwSr-IHwDrt4cd-UujzidoutQ>
<xmx:irrramyjN290rHLZ0DirGDa8UlO8Ctz-h6Yh4V80-qq6FjrmYcLnqIDw>
X-Feedback-ID: if26b431b:Fastmail
X-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed,
4 Nov 2026 18:06:50 -0500 (EST)
X-Cc: git@vger.kernel.org
X-In-Reply-To: <20261103212410.1389988-3-jltobler@gmail.com> (Justin Tobler's
message of "Tue, 3 Nov 2026 15:24:10 -0600")
X-User-Agent: Gnus/5.13 (Gnus v5.13)
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list