From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=202.12.124.158 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796521549; b=Eibq4Z7sEj1hvibDlhvaRfK2YjEQA8TNqFwq8KmTV5Ms2eH7S8rRc02wdKmkLOJ8EZC5 +AhEjtiQdMuZTf4dK+IZcW3thhiWloaTBpG6Sn8lhsAtabhy+ofn9IWZ6VEj8O1fOH/gr IOzCi28zgGfB2sB4zrSIfzRvr1BpFvFGJ/nRCE7zzjCH+Jl+ZZTapvxd+VqiqPAlcWEGE Ccs+/xrxffx4lTQXJPEC5cyjnusz+N4M4B65Iq8Iz+Z4iccHfCMND30UsmjpsTymqrvuK BBlx+MYT0gfdoefxDVmPshDpwXTjgV4Xo/QnJNd+J/OIpLCSMryu90g+tCIKRxT7RhA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796521549; 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=Oz/fSiV7oWvaxfoZELJEeibbC5yN89JMz2ClmD0mbxY=; b=MHau3qHya6TyJl+ajoNx1xTGdPAYGdhaVVaioo/2ANofcJKXRw/BnnnIszSKzHf8tutK cr06iuV83T4StVMaFowE4IvP4cao09TPGUzyaROBvLACbMRM8ZacRL97v4xeJ6+ogavIz gwF7rjJp8/dpMojCa91SQ4EDJ03wBSUInGc6+lUdmnWmZFHg1VOw+9pBboX9sbhJDp2ps /X0K+JfTJgFNFjEtnGuMPUA+0e9jcCDEntM4TAW7iwtstK6XiHxKaDAMDiXe6Wijn+6ag D2himrVuXlpXzsQxSRMOqYeac9ujfAdmTXmHv25OciEJ/KJoVgZefH6XA2PM52LnDgg== 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=fm3 header.b=oYuHl3uk; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b="N/Vs0Ugz"; arc=none smtp.remote-ip=202.12.124.158 Received: from fhigh-b7-smtp.messagingengine.com (fhigh-b7-smtp.messagingengine.com [202.12.124.158]) (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 2F6E5606A31F for ; Sun, 6 Dec 2026 01:45:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2F6E5606A31F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com 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=fm3 header.b=oYuHl3uk; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=N/Vs0Ugz Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfhigh.stl.internal (Postfix) with ESMTP id 3B6607A012B for ; Sat, 5 Dec 2026 20:45:48 -0500 (EST) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-03.internal (MEProxy); Sat, 05 Dec 2026 20:45:48 -0500 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=fm3; t=1796521547; x=1796607947; bh=Oz/fSiV7oW vaxfoZELJEeibbC5yN89JMz2ClmD0mbxY=; b=oYuHl3uk0gUdXiDDJQ8rRbQS7g DTq9vtLJiNTSQ4XNMFpEkRUtraIf/2/vw2exo81l70//ea9/SPd53uwqsyWAJKmy z6aBYA9r6PSq2NIDlDbePB/6tVRS51F2R2DMe8B7GK+gJi480Jit9A8Zs8NXXs0u EaY2v+vA2Q3v2U5DnhxW1BDFIVCpgCrf76f/m7y+XVowRHb5hxWkXL3P1J7iOsiO e03Xg1jnHEiALCChBsKSRxig4iS2PHwa/CslQixBU861Nb5RP6DK/7pyIrSIlKrw evd7FiRqYL5dv9CDd7ptmKcuFIKeJBtGh5LFSO2I78AIl1rUF9msFp1mF3gQ== 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=fm1; t= 1796521547; x=1796607947; bh=Oz/fSiV7oWvaxfoZELJEeibbC5yN89JMz2C lmD0mbxY=; b=N/Vs0UgzfkI52SXxrS3UAMCTxuAWb4uC9KGZhSepbdequeUyrvd YeLyqywVPbnYHOKiDq6oMNZn+e9sc8KJtgiQG+Y1ppTpcd7Y94JNTgRGr5SsQByU 1jecwqV1LGq4AFHh8A0hWz/2yYYONEmiXEP0rM7JRlMGAiEMOc9u/3WqVNMCJIV8 c759x9wfZKcLqJL64ZJ6fiouQu3/hHQ2nV1kwf0ncBZ38tSWGf1hCmcx/O/rXAIS zOxvhvu6cTRB98foY8HbTMjjGqOd9YDhcsbtvgBE+qyy32IDUMH1DnZFd9WQtm00 Le2nU73ol2Zr50R371zyCVBM96GYEeMADow== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=pobox.com a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1796521547; d=pobox.com; mf=PGdpdHN0ZXJAcG9ib3guY29tPg==; rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+; s=fm3:rsa-sha256:IxOyxPl/0Z05DrYPgDiNf7lsiQvaAj536+e4p+gfDvj3ew0 j9vEhRQY7pbH49hJM38Age4cMfBSHFNTBFNSGR+8p3zOu3aPLVcVsfCdigxSMiPR PmeuJVHlPR88Tl2NcgyWShgV4T3jG9r7r74nep8kGpCWb7cMPcZJhLd5AbCdvC6s LhtSoGXKzpOmRAlRnN86NthaLOm2DQDiyMP8AyqBOTWIfTzhekeDMlHZXqBzLBK2 mDSRsynp4nkTIh3wS/Jg+wLFjKPV5nIXnDkVwbTRK84GFM9xYXIdSfhWY9GNs2oI BLCWsZLkpiGJXyfB39Xk+WDqR3s1gQc8f38POog==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; 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; Message-Instance: m=1; h=sha256:m6peN/HN3U1lMjxXO/RaVtoI7wwfcDKCwXQOlzYxahQ=:68WXeF6216M0fzc2DWk0q1QoS6pIjWUhWFk0gnzjSN4=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTGi47u6rlhgX37arRmQ3xra+tmUiSZMNZXTpifoH3n+Uhf7Gcez3At2/LY2JV5QgR BPyXcWgOgjPy/Mhx3KWgik00qNSfR6Yn3I07AV95wPikGV4Hua7jzLKApGZMmMuPnWOoBx usuQppO5FjDSgqaJnV/HOiDmqN3eDQBKZgH4D29g6sFjSFWzNDVxfmksh+7ooiUTmR0KE0 KQwngiZRDZ9hlZVus7Analxp47FPlGyaLU7DC20p98wFJXUu4pemmaUlQQDAWtpFTSN0iV pabamEUAAovhyvWmJy3z12KZWPGRxdDDnmH9ogDAHlh5fx68gMVkYKYPoggr0yTxowasSt 8qUqiW4IJcpzI3wYAi2NCUs6sRalMrRbuDL7/zZRagV7fXMW5xWaFxRVizGauBSUwJC0// MYYAwIOLgNiVLEprNU37JSGKDxJonV702U+osF5n/JkAggkAejZ14hNxOvsZCFwUVrOCd8 kzdp9xSLZoKEaKVkymvhdzoUapcVmPxJzCRPq1Ewf3X/GwpvgK8YFJ++nxIzPL8Luk0FZb H20G/tUbBQaEZ7/95pQn7rUtL/fH5LRNKwKnE4BAgRDe+XEUba412SAwWYmBE+n86Fp4Oz 2qDbpbVAAnFFoF/OtV5TcVKMhvM6gMfk4SCoz/yMbmEfMxK5uPKj9P+QnU1g X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 5 Dec 2026 20:45:47 -0500 (EST) From: Junio C Hamano To: Adrian Ratiu Cc: git@vger.kernel.org, Patrick Steinhardt , "Eric W . Biederman" , "brian m . carlson" Subject: Re: [PATCH v3 3/4] object-file-convert: match tree, parent and mergetag headers by key In-Reply-To: (Adrian Ratiu's message of "Mon, 30 Nov 2026 15:43:24 +0200") References: Date: Sun, 06 Dec 2026 10:45:45 +0900 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain Adrian Ratiu writes: > convert_commit_object() only enters the "tree ", "parent " and > "mergetag " cases when something follows the space. > > A line like "parent \n" falls through to the final "else", which > rejects any line it does not know. > > The next commit makes that "else" copy unknown lines unchanged. Then > "parent \n" would be copied into the compat object instead of being > rejected. Worse, a "mergetag " line whose tag starts on the next line > would be copied together with the unconverted object ID in that tag. > > Use "<=" instead of "<", so that these lines enter their own case and > are rejected there. > > An empty "tree " or "parent " fails the length check before > parse_oid_hex_algop() is reached. An empty "mergetag " leaves a tag > that doesn't start with "object ", which convert_tag_object() rejects. > > This doesn't change behaviour: these lines are rejected as before, > only now with an error saying why, e.g. "bad parent in commit". > > Signed-off-by: Adrian Ratiu > --- > object-file-convert.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) Splitting this into its own preparatory commit makes the motivation completely clear. > > diff --git a/object-file-convert.c b/object-file-convert.c > index 63ee18630b..af14cf8300 100644 > --- a/object-file-convert.c > +++ b/object-file-convert.c > @@ -167,7 +167,7 @@ static int convert_commit_object(struct repository *repo, > if (!eol) > return error(_("bad %s in commit"), "line"); > > - if (((bufptr + 5) < eol) && !memcmp(bufptr, "tree ", 5)) > + if (((bufptr + 5) <= eol) && !memcmp(bufptr, "tree ", 5)) Using <= still keeps the memcmp() reads within [bufptr, eol), since at equality the trailing space sits right before the newline at 'eol'. Empty "tree " and "parent " lines then fail the 'tree_entry_len' and 'parent_entry_len' checks immediately, and an empty "mergetag " seeds 'tag' with "\n" so convert_tag_object() rejects it as not starting with "object " even if continuation lines follow. Nicely done.