From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a3-smtp.messagingengine.com (fhigh-a3-smtp.messagingengine.com [103.168.172.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C55CE30100E for ; Wed, 24 Jun 2026 16:58:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.154 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782320309; cv=none; b=j+6MiKXNQ8yRfKYG7ip0xtoYXbFJCIaPlrUuo6VZauCTTBW8f5HjWeNoJcXydbjtibNSJgYJ8XK0Z36kW7FDh0FcxKzFuVpKyXcSIU6D/0GlvoY1bzq4dwAL6QfBDDi9jHVEwh8ZMhJeplcTrobmkvKR+jKqh8IwjOWkHJb7M/A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782320309; c=relaxed/simple; bh=/bYjDBDztCIJOaYbfirSakluu0QNtm8ooN2ckA0mJaA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=mNmIgKHanqhJfh9+aXI+Dfg4w0PSxuVyQf1wpHCyBT7c1IBT5tfMiRYEwJAakIa6s1Sj2zQlkvqftpB6Y904KlEDMTUQrbopZ/gob6IbVUNfv1tpGgU1BhOn+Neuhej17GbwJ8zoSCJhfyeS4GoAt5UR7+aXrI4WeDgFTB3IZnw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=giLB/Mmd; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=PMjM3D8K; arc=none smtp.client-ip=103.168.172.154 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) header.d=pobox.com header.i=@pobox.com header.b="giLB/Mmd"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="PMjM3D8K" Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailfhigh.phl.internal (Postfix) with ESMTP id 118AA1400184; Wed, 24 Jun 2026 12:58:27 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-12.internal (MEProxy); Wed, 24 Jun 2026 12:58:27 -0400 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=1782320307; x=1782406707; bh=YhfYeVQ1vu PAahwGXuec/boVQiuFWO70TyPka9fYWnI=; b=giLB/Mmd5VFCSuiqh3k4B/1gdr BqgGiTeUVN5uN0Ns95uK40Uqtl/bz8FRn8BtUNdqAA2WJ3efXiXOLjX7iKj4O6gl dwim3YnvwLCVyqqIveJj7M0YWwasMI6wxMaXvtX6Kffynhw5TK2VE/MOOQZ+4fQc EeP8xqmIoMYjdfUg3tYNdKMwoxNUNxsJYUM4qR6yMgcdx2FP1rffh6IBZVFP98Ge 61Ifw32OJyltRJb7Gz6t5WzLAkxUKodmylJmk7wpaLxA/uhMidA9Q7NXj+q6xzeJ GVdT4IlSO581+3dN4ErsvEORzVru4gavaV1GUJNYvEsb35Ny56aQnL0txxLw== 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= 1782320307; x=1782406707; bh=YhfYeVQ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ITiaw/liW11VOXgHziU+deVkgDc3sJOYHwo0tbDp5Q2fXOQ X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 24 Jun 2026 12:58:26 -0400 (EDT) From: Junio C Hamano To: Antonio De Stefani Cc: git@vger.kernel.org Subject: Re: [PATCH] gpg-interface: fix strip_cr_before_lf to only remove CR before LF In-Reply-To: <20260624093618.17456-1-antonio.destefani08@gmail.com> (Antonio De Stefani's message of "Wed, 24 Jun 2026 11:36:18 +0200") References: <20260624093618.17456-1-antonio.destefani08@gmail.com> Date: Wed, 24 Jun 2026 09:58:25 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Antonio De Stefani writes: > c4adea82 (Convert CR/LF to LF in tag signatures, 2008-07-11) > introduced CR stripping for GPG output on Windows, but intentionally > stripped all CR characters unconditionally to "keep the code simpler", > even though only \r\n sequences (Windows line endings) needed to be > normalized. 2f47eae2 (Split GPG interface into its own helper library, > 2011-09-07) moved the code into gpg-interface.c, and 29b31577 (ssh > signing: add ssh key format and signing code, 2021-09-10) extracted > it into the remove_cr_after() helper when adding SSH signing support. > > The original laziness was safe at the time because lone CR characters > are not expected in GPG signature output. However, the NEEDSWORK > comment left by a previous reader correctly identified that only > \r\n pairs should be stripped, not lone \r characters. > > Fix the loop to skip \r only when immediately followed by \n, keeping > lone trailing CR characters intact. Rename the function to > strip_cr_before_lf to reflect its corrected behavior, and update > both call sites and their comments accordingly. > > Signed-off-by: Antonio De Stefani > --- > gpg-interface.c | 25 +++++++++++-------------- > 1 file changed, 11 insertions(+), 14 deletions(-) Looking good. Will queue. Thanks.