🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #2865

Re: [PATCH 2/2] object-file: return error on index-pack abnormal exit

#2865
From: Kaartic Sivaraam
Date: Tue, 10 Nov 2026 17:57
60 lines
13210 bytes
On 11/10/26 22:13, Junio C Hamano wrote:
> Kaartic Sivaraam <kaartic.sivaraam@gmail.com> writes:
> 
>>> 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.
>>
>> +1. I too have a slight preference for the old flow of having ret = -1
>> and resetting it when there's no error. It may not be worth a re-roll,
>> though.
> 
> Note that my comment you quoted was made with a misunderstanding
> of the patch and misses one important point, which is that
> read_index_pack_report() used to overwrite "ret" even when it
> succeeded, but the new code uses a separate variable to avoid
> clobbering "ret" when the call succeeds.
> 
> In other words, the original failed to honor the "have ret = -1
> and reset to 0 only after seeing everything go well" pattern,
> either, and Justin's patch is a definite improvement.

It is an improvement indeed. No arguments about it. I was just wondering 
if his change could also include a change like this on top:

diff --git a/object-file.c b/object-file.c
index e04ce0bc11..c52004014f 100644
--- a/object-file.c
+++ b/object-file.c
@@ -1429,7 +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;
+	int ret = -1;

  	hdr_err = parse_pack_header(&hdr, pack_fd);
  	if (hdr_err) {
@@ -1498,13 +1498,11 @@ static int 
odb_transaction_files_write_pack(struct odb_transaction *base,

  		if (finish_command(&child)) {
  			strbuf_addstr(err_msg, "index-pack abnormal exit");
-			ret = -1;
  			goto out;
  		}

  		if (report_err) {
  			strbuf_addstr(err_msg, "index-pack failed to report pack name");
-			ret = -1;
  			goto out;
  		}


But, I would agree that this is a digression.

-- 
Sivaraam
Technical Details
Message-ID: <590c5765-fc4e-44da-9326-b8242caa80ae@gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-75107-linux-kernel-git=dewy.ru
References: <20261103212410.1389988-1-jltobler@gmail.com> <20261103212410.1389988-3-jltobler@gmail.com> <xmqq8q38yz5i.fsf@gitster.g> <4c7c44df-4eca-4abf-a825-1bb3b16015c2@gmail.com> <xmqqmrrgtz6i.fsf@gitster.g>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-75107-linux-kernel-git=dewy.ru
From: kaartic.sivaraam@gmail.com (Kaartic Sivaraam)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH 2/2] object-file: return error on index-pack abnormal exit
Date: Tue, 10 Nov 2026 23:27:43 +0530
Organization: Usenet Network
Message-ID: <590c5765-fc4e-44da-9326-b8242caa80ae@gmail.com>
References: <20261103212410.1389988-1-jltobler@gmail.com>
 <20261103212410.1389988-3-jltobler@gmail.com> <xmqq8q38yz5i.fsf@gitster.g>
 <4c7c44df-4eca-4abf-a825-1bb3b16015c2@gmail.com> <xmqqmrrgtz6i.fsf@gitster.g>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="672215"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:jAMEDn/zDKfLiQPLk5Wwg/dXurY= sha256:XIfz3T13gXNnjJp3dtHfK0xnMojYZ01n+ukJ81hPtU8=
	sha1:JL2GHDiH5QqM/jTf7JV04Z3MggU= sha256:f5/ZtDcsxggVk5lMrrYxtPAVTJZHuaAAcYNvlR27QTA=
Content-Language: en-US
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 DDB9F113CB8; Tue, 10 Nov 2026 21:33:08 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.949
X-Spam-Status: No, score=-1.949 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, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, 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] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
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 lq0q2hswfx9l;
	Tue, 10 Nov 2026 21:33:05 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=git+bounces-75107-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 1D144113CB2; Tue, 10 Nov 2026 21:32:56 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id CD72B1A5E78; Tue, 10 Nov 2026 17:58:23 +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=1794333470;
	b=pp+Rc8tha5FQHC6JQl/2LNNKNZvJvivuKxZVbDrJct4jBfWp65DRJkRewfLTDQDsrJrS
	 NfRKqttYz0kNJqBnw4iFXDcIF0l8SUeshsJH70nQMxoh1qIwL3wWr29lfsxvs75mEZW8h
	 /yIA3qVYfGLCLjkliGFgprgCHjxbTZ2c2XNGjh7CBx39mCRdKIQGIc/N7HhjMZ93v69jJ
	 PKljbIwMyjxyCsvZZPSHn0ReW5yduDz8RtfcuKnFtK7qQXIgd/qPzPFuOf0D8vsZ9oFs1
	 aQZgbKUP7AWMK5VDjWqVDgTyCKNct0Po54rsaQVvn5n9zSbWntUQAPXCsqltiudEPKw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794333470;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:Message-ID:Date:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:User-Agent:Subject:To:Cc:References:
	 Content-Language:From:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding;
	bh=icA5/fEwF52HBhBQrCkbUDY+LpdpqX2vVSeqAswzBqo=;
	b=mK2mTVeh3Wz8Mzlym0clq07C4hI7SXSWxgSI54NBb3E53Zw7ZbphZgCjf14ESECW0MPO
	 uR3ZbPx0nwTCAxxH3PueuTuX5NNO2V64GQUAtzOjPcbmKTjyvTcJBHlmXet18LuCi84xQ
	 Xc/xEtpqosnyMBBIM7GR6/4qQj2R8Hl5tPvb/h+Eb9BJYCoNjwowplnVAX/boO1e5e0+J
	 iNpDJFG7Id8tzFFisJzyet2BEvBTwGZF9T2xbfwDQ04YY0mGw3POHRY5F5ImVsunfXjlC
	 Y9a+ZmstLhwGcpJXrjlV4vTLjFdKfL84DtOn7GSVx+jgtKRA9tRYvPFkocyjry1OFoA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=E0UZpfpW;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.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 2ED61606A227;
	Tue, 10 Nov 2026 17:57:50 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=E0UZpfpW
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.175
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794333469;
	b=qdlBr3tEv1DRQRKVKENJUX29zPE4i62N/4okhzYb/cn+yAOAW4xZAEMz9xllmVVSQQ9D
	 eir09IfSpTnoIOcUai2TQjDTDRlRip5ZEH4Tn8uWJGmp1oWh7Ysprj8rUuwroprwziZMQ
	 PXPdT5pI2BxBV/raHBV3tRvaiYjVaQ9seSm4xcyxfm1jVD9naye18BEX7x4Yd/rX3yxED
	 aBt1cprrqdBJXkvgNdKsS5R+i3penT9Rp6nmSHH//tv/o+Ta7vkDAXNQ2PdhCvEbxdt90
	 kYFcwh07GnU/r4J5FHoJDUJHCpP7ORi3Iv+Tj3b+qTlpV/lMeJ1iSWg+Nj0kHV92+6w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794333469;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:
	 Content-Language:From:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding;
	bh=icA5/fEwF52HBhBQrCkbUDY+LpdpqX2vVSeqAswzBqo=;
	b=jZ4IjyKHPvoTwrHhdUBroGOnRs3bY+l+piq9TiY+3mrtYddt+AVrDAlacFONFyAz8XfJ
	 8rLxo/NVoBtk7azfFnBOUZintC6pj2Za4u9/Qe6qlgfKLvHCD8o7xgI0OqLNlNrSmCBLT
	 HnnFzh+iErr+CCY8eZmKg/cRt/Z5kQ+Ocq+7Yj6yAM4TEprssTukYvP3X3uqvxQtYYFy5
	 yNcRah8ncKH34RYVyrjcrZBSbgWs6pO6qADU4vNPyOhIlk0nYG22Tjz8vv5qLiFNbo/5v
	 4FGHUQUdaKV9ANwiI4ArrrS0P0IaeAwIQfIgVtjvmWUQmcalWhr9KOwPRZmeEgTnIpw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=E0UZpfpW;
	arc=none smtp.remote-ip=74.125.82.175
X-Received: from mail-dy1-f175.google.com (mail-dy1-f175.google.com [74.125.82.175])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2D26606A219
	for <git@vger.kernel.org>; Tue, 10 Nov 2026 17:57:48 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F2D26606A219
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dy1-f175.google.com with SMTP id 5a478bee46e88-37000e7234bso4272309eec.1
        for <git@vger.kernel.org>; Tue, 10 Nov 2026 09:57:48 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1794333468; x=1794938268; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=icA5/fEwF52HBhBQrCkbUDY+LpdpqX2vVSeqAswzBqo=;
        b=E0UZpfpWypDxRIqMm4cV/9jwC6p0+kaT/coSkLjR9j6HSyXPxuaGwsCbMt+dQNUtoe
         Eq5h2s80L48t3IDr2xoocEQhuA9ObNmCWvcbtGdh9QxJ2ZJAMC2rXtsl7IJbF0p2NPsx
         HWu1/gFyQfM6/AbPeNEka6aKUCCkmaVkj5hJorfxV/01UKmtEQgBixdnlXphgeEev1V7
         WGFk6MeVbQvLQZSmsvuB5v0dijMrufqpBAD6zqH1V3mbvElcYTpLQPDuNFochr4BisOS
         Nk3mpfGs7cVtBqjCzswoen4au6R5yXoQNGkmi4bVUI9gGUzsNAO4V6H3daWyo/T+Y/jz
         PyFA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1794333468; x=1794938268;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=icA5/fEwF52HBhBQrCkbUDY+LpdpqX2vVSeqAswzBqo=;
        b=w1umBqfjHwS/mT8MBmP/8NxdgnOKjLTmdDnMzh4IpvaBmQTBDHRVoVLKXcOKr0XJwj
         mRCSny8lnRwez6/IHWjdQqugDKlLE83Fs77JjT2fx7Uqqv3tjP2tRdth8jknUc3CfrSY
         +jrgkFVN91l/dCsRFcvrHmSQBIKi2rky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SpV+ZcOJq/1qDgDIILOa7la0gY84oMcP2ME3DeMyqQsyUd+ElS
	viCjKQZ0mdTA0HeXmg5LjzuBQnoMqXw==
X-Received: by 2002:a05:693c:8004:b0:36c:a321:9fbc with SMTP id 5a478bee46e88-3768395f0e5mr77377eec.1.1794333467992;
        Tue, 10 Nov 2026 09:57:47 -0800 (PST)
X-Received: from ?IPV6:2406:7400:12b:37cf:603a:4d43:6b5d:dfdc? ([2406:7400:12b:37cf:603a:4d43:6b5d:dfdc])
        by smtp.gmail.com with ESMTPSA id 5a478bee46e88-375212ec002sm9772882eec.26.2026.11.10.09.57.46
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Tue, 10 Nov 2026 09:57:47 -0800 (PST)
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
X-User-Agent: Mozilla Thunderbird
X-Cc: Justin Tobler <jltobler@gmail.com>, git@vger.kernel.org
X-In-Reply-To: <xmqqmrrgtz6i.fsf@gitster.g>