From patchwork Sun Oct 27 22:34:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Maier X-Patchwork-Id: 13852750 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B14E517C61 for ; Sun, 27 Oct 2024 22:35:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730068502; cv=none; b=ts9o9hrHSqFqr5D4ouogE8boEIHP9hUchGAx8C6bLu7rqtB3t1JJrpLVxzRG+ZUsmL4wMNT34543eHLugmyl3QH6WRaE1M4vAgb9gNZPji0tYVGoV9xMYuSjMFjwml3SGMnxXWB4Yx6ik6GTtwfXlqV702GX7EWLnWutVBrMLDk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730068502; c=relaxed/simple; bh=s0GkUkyI+xw4qoZyT7emCLlXC/bH1dUlbaE2XltqqKI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EaGnFnw0K/s8s5/FIi1KDduxbtQZ5aTgG0/qgn/enWsr48heAdqFyvtzaAGhcSR3dnpCttCxgmThUGJLk+f5B5k5aOuu3JkClUxQUShnI9jYdDxC2JwKx//rwF+mgBTBsshfQSWCsYVsJpx+nOODHG2D41AC1TdDpXaUZjcDNk8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FAYPvAIf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FAYPvAIf" Received: by smtp.kernel.org (Postfix) id 9993BC4CEE5; Sun, 27 Oct 2024 22:35:02 +0000 (UTC) Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id AC95AC4CEC3 for ; Sun, 27 Oct 2024 22:35:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org AC95AC4CEC3 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-il1-f181.google.com with SMTP id e9e14a558f8ab-3a4e48b61fcso9280885ab.2 for ; Sun, 27 Oct 2024 15:35:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730068501; x=1730673301; darn=kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=zTARtdoY1LxckmFLu4z4WfI+G6/jlXJBnTBQVa55xSo=; b=FAYPvAIf1BSx2iORvSxr96QEuVKCgxY2W2fPI5i7lge4SiZMdAQIYKm6RMFsseDlAB 83FwZOFxHhW81uE6fzFVr+kfnPNuabP0bY2JtG66gD+GPz+BKfPwZ4okHdRVGXQ/QG6X Dom9sFy4g/oMVZWvesdnCoF6SpIG5N70gVfAhH+9NZNW+4o2PFtQykyRyhlQn9LsTiHF rmnPd12GN4wVUnxbZZw9MOB3bpd+kFOLBR7QyVfZw82HAWg7WVaoVSD79I574EAOxnXf oNUVUbLuXzC4/r7fO5hjCiBTR5si6JsHiT0o0AvSh3/qF7wL9/fsXI9OmSLmn2OnJgYG zg9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730068501; x=1730673301; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zTARtdoY1LxckmFLu4z4WfI+G6/jlXJBnTBQVa55xSo=; b=TkrMQruhmyYmuRowDsgFdMJiHJXPTW8ccC0UhREkzGA8ghjvV55LsxodD1h6slwyfK wIlXs+VZXzBe2acCY3tp00iwWMxBc4zPF5U1kY/IZgYm79Fwo69+2LAUgUU2rApNdraP Yy16/zzjyC4PrWp+CVTfayapZwGW2+ftigJe653Fxk2qlr0qq+GHnx9+A6aJVjaUWoxx xT+Sb+ftmvLsHICGWxVx2I/mkfjl4AeIiQKOYRUolOVqgQ6iRM/+RjU5A28AzFqhWv1f p1UQJ7aE8eJbHwbdeKFzzsv64a5j0VOoZcTUkcUS40HZB2TBVK1iaQ2gILMj9GDuKxaH lYmw== X-Gm-Message-State: AOJu0Yz6HYgchfWFQtctV4ax9ORVqtaKiSapxnvpgLQxc5tG+VDW5s2J kHQfMB7oqZTx36J9Y9OkwAJ/8dcZvsHtrGvRGG12BLKI+iXergtqIWgL8oNE X-Google-Smtp-Source: AGHT+IHf5HrCdtG5ULjfrPHmhZ1+xbPIUh0mGM88bUxLGZG/n6nFgfi2KGmXa/oujOZqAo03q50LBg== X-Received: by 2002:a05:6e02:198f:b0:3a0:90d6:1f39 with SMTP id e9e14a558f8ab-3a4ed27a632mr52115805ab.2.1730068500669; Sun, 27 Oct 2024 15:35:00 -0700 (PDT) Received: from localhost (207-191-210-45.dhcp.imoncommunications.net. [207.191.210.45]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a4e6e022e2sm13464625ab.51.2024.10.27.15.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2024 15:35:00 -0700 (PDT) From: Brandon Maier Date: Sun, 27 Oct 2024 17:34:54 -0500 Subject: [PATCH b4 v2 1/6] src/tests: check trailer extinfo Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241027-trailer-special-chars-v2-1-e963f78b3ef8@gmail.com> References: <20241027-trailer-special-chars-v2-0-e963f78b3ef8@gmail.com> In-Reply-To: <20241027-trailer-special-chars-v2-0-e963f78b3ef8@gmail.com> To: "Kernel.org Tools" Cc: Brandon Maier , Konstantin Ryabitsev X-Mailer: b4 0.15-dev The b4.LoreTrailer.__eq__ ignores the 'extinfo' of a trailer. So the trailer test is not checking that extinfo is parsed correctly. Signed-off-by: Brandon Maier --- src/tests/test___init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/test___init__.py b/src/tests/test___init__.py index 297e5120a8c8adf241660f06e9a83c1ff4a0fd3a..dbc92c7e8352728c2f2a951f7b9b1496ccbaf2c5 100644 --- a/src/tests/test___init__.py +++ b/src/tests/test___init__.py @@ -79,6 +79,7 @@ def test_parse_trailers(sampledir, source, expected): mytype, myname, myvalue, myextinfo = expected.pop(0) mytr = b4.LoreTrailer(name=myname, value=myvalue, extinfo=myextinfo) assert tr == mytr + assert tr.extinfo == mytr.extinfo assert tr.type == mytype From patchwork Sun Oct 27 22:34:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Maier X-Patchwork-Id: 13852751 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 99C2717C61 for ; Sun, 27 Oct 2024 22:35:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730068504; cv=none; b=fRV4nLZaObfzondc1MZoIz5JHYukZb/M9Q5hdmgCPy1TLCN6tfZMfvQQX8ljSH3uFcOsi18ilyHOAO9imDcM7Q3DKmyXmHGjVi5nCH0G4Z4ymYzV4LapQ9UOzff/KAQex828p8zm9vlXOt9+jf53HLUqE6WfXOESp0t9aYsK7UQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730068504; c=relaxed/simple; bh=bl0MQPpbsfgbfqmd1BPBHQsu6XfUgO+CUPuk0F2si2k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Dnt4o6aLawVSg0oI9k0feEJIcPtpsr39dnXkIv0Xieu8+dcV1yUQKhAppPvOwl8oUA2a8/wxYc7VDF7DGaTjsO4gy9MwLjlcqK/7CGu3kNNmBxqRBAf5RJFp4tSOhrRWuwCuwP6CUNzJxxv25ogjPhzNAOJSM6n4hrJs/7I0plU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=V/mucvjR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V/mucvjR" Received: by smtp.kernel.org (Postfix) id 40963C4CEE4; Sun, 27 Oct 2024 22:35:04 +0000 (UTC) Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id DCD3AC4CEC3 for ; Sun, 27 Oct 2024 22:35:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org DCD3AC4CEC3 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-83abcfb9f37so144513839f.1 for ; Sun, 27 Oct 2024 15:35:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730068502; x=1730673302; darn=kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=feNtiNDrvPASm9AMoQZM6ZYoF2Qw3Q8IJGxUNfSfC08=; b=V/mucvjR/aFh1PM1DiPc6RlKzTOv8oXgw7Y3OyjSnrMPCryVS4NBztx18ZiSrftJom S0Y0l3p1GwxlR2+Fh/8BZKbX6a92uerrp4XcJVl3rugJejc9jk/JafI9Mre30Mb/2aWs XAWhRU9VamHDqatix+UL5YQksuNcZgrCyP+5wqkj6H6ecAariAr+TxuJtMyawPa5U9kh OWmdaFxLxRVYyLYmmwetTrpPnofCUk9oMuDsM1ToBcDLPYHH4l9pWq9UufbSIg1lkdpO ggVEuciPOB4jyozB/vyUFAyXUW62VWKmJhMTrlu9Aq52uO+J5sY2mHkN+SUJztvPG+uF WeZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730068502; x=1730673302; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=feNtiNDrvPASm9AMoQZM6ZYoF2Qw3Q8IJGxUNfSfC08=; b=DK14OTMTkbfIkUn8DZLV9Xaf3b0YgEaKCH9fTdKBK+Evk7pDkOtpnrklMhuyx5ayG5 kMFnq2i6Y20qu/6WgdE/wyAE8A57AUExnQD8TOEZenXHj42fKwc0lFRA4qJgVrNUalho r+ytE2PcmwK+YRo5FQe2L7Wu/o4NwSf+aktorDcqhEOQDGrHUfeOhX9g0wNfdCpUN1HF +fqoEL2YbXDzVbts3/PB4pRZdi3BLj+/xYEd5d7wJsm+Q+Z0FpJM8Hx8qMCSUgUd4veH trWUxk2bYMuYHTk/zNklsbhoSAj9AF5Pu2eyhOCHwRsAnCyxU/L/BCZfNhT7TEfDJrAA eG4Q== X-Gm-Message-State: AOJu0Yz7IFbxLlwkABse4TmjgT3JrWZMl5PfRdsRYj7wrNlSw2vcyZEd 31t42iIGWl41qv8kmUyCHPZpzzIdDYXshwFrKtI66KT6n5wBiabDyLpBrEna X-Google-Smtp-Source: AGHT+IHRtr9oP6IF5Qk82pkmSOZBIN9MTA5nnCssPzEvpjMjWQysUzL2pl4i9uqGm32NaU4WtpnYfA== X-Received: by 2002:a05:6e02:16cf:b0:3a3:da4f:79ec with SMTP id e9e14a558f8ab-3a4ed295ba9mr50288275ab.7.1730068501802; Sun, 27 Oct 2024 15:35:01 -0700 (PDT) Received: from localhost (207-191-210-45.dhcp.imoncommunications.net. [207.191.210.45]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4dc72784db5sm1358647173.148.2024.10.27.15.35.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2024 15:35:01 -0700 (PDT) From: Brandon Maier Date: Sun, 27 Oct 2024 17:34:55 -0500 Subject: [PATCH b4 v2 2/6] src/tests: fix trailer test hiding parser errors Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241027-trailer-special-chars-v2-2-e963f78b3ef8@gmail.com> References: <20241027-trailer-special-chars-v2-0-e963f78b3ef8@gmail.com> In-Reply-To: <20241027-trailer-special-chars-v2-0-e963f78b3ef8@gmail.com> To: "Kernel.org Tools" Cc: Brandon Maier , Konstantin Ryabitsev X-Mailer: b4 0.15-dev The trailer parsing test compares the values of the b4.LoreTrailer object created from the test input against a b4.LoreTrailer object created from our expected test input. This means if there is an error in how b4.LoreTrailer parses input, it won't be detected. This was discovered from a reported bug with parsing email trailers with embedded ','. Bug: https://github.com/mricon/b4/issues/50 --- src/tests/test___init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tests/test___init__.py b/src/tests/test___init__.py index dbc92c7e8352728c2f2a951f7b9b1496ccbaf2c5..7fe43b0158460f06d0a2b52d2689d26e7ef7f840 100644 --- a/src/tests/test___init__.py +++ b/src/tests/test___init__.py @@ -57,7 +57,7 @@ def test_save_git_am_mbox(sampledir, tmp_path, source, regex, flags, ismbox): @pytest.mark.parametrize('source,expected', [ ('trailers-test-simple', - [('person', 'Reviewed-By', 'Bogus Bupkes ', None), + [('person', 'Reviewed-by', 'Bogus Bupkes ', None), ('utility', 'Fixes', 'abcdef01234567890', None), ('utility', 'Link', 'https://msgid.link/some@msgid.here', None), ]), @@ -77,10 +77,14 @@ def test_parse_trailers(sampledir, source, expected): assert len(expected) == len(trs) for tr in trs: mytype, myname, myvalue, myextinfo = expected.pop(0) + assert tr.name == myname + assert tr.value == myvalue + assert tr.extinfo == myextinfo + assert tr.type == mytype + mytr = b4.LoreTrailer(name=myname, value=myvalue, extinfo=myextinfo) assert tr == mytr assert tr.extinfo == mytr.extinfo - assert tr.type == mytype @pytest.mark.parametrize('source,serargs,amargs,reference,b4cfg', [ From patchwork Sun Oct 27 22:34:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Maier X-Patchwork-Id: 13852752 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A342717C61 for ; Sun, 27 Oct 2024 22:35:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730068505; cv=none; b=n0zJJ5A96QJv7GDeoVdEYdW3YT31r4M0QJHQ+nqRmGnkIzCgBIhLb6mIwe+Mm8XEJ8zFlbLP7JOrMmCLZH4XG2Iy6E7A/AmFpYbGeN6VsVGRWDXyhjoqxu1V+eZZfs2FmLCbUANV+XC3SLrIOCYkN9HwYAIKt1r8wNGqhz8pA6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730068505; c=relaxed/simple; bh=FoJJ2h90LlibaI4SbrmizAGIBwMOx15jNQuyL67WDHw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VJtpcP6N2M3l70XmR7SgSd/mPSmOpO/Hn3teF9b2Gr7fWGHsjrCdEcGc52OP+BQ/9BAG7ZHQmzl4oTxhQWNNz0WAdKREBW5yM6PKc9iQsyW+Y1MwkAa4gE6ZvX5mXU+VR555oUE1TQB6v4FtBiPjjnHlOXabysFIwh8eJjHpID8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QfjmIQ+u; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QfjmIQ+u" Received: by smtp.kernel.org (Postfix) id 5AAA4C4CEE9; Sun, 27 Oct 2024 22:35:05 +0000 (UTC) Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 7D3DBC4CEE5 for ; Sun, 27 Oct 2024 22:35:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 7D3DBC4CEE5 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-io1-f46.google.com with SMTP id ca18e2360f4ac-83aae6aba1aso125234839f.2 for ; Sun, 27 Oct 2024 15:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730068503; x=1730673303; darn=kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=bTKpU7tb6k7g67R2E6TGtP/hOf6u3m1LQ07VQt+VPxQ=; b=QfjmIQ+uqRS0Cv8UadOLdt5KEfRQLQ99dceFx62W2ffAxzy0lHmKEYNEy9DncVifKo A96h7jQTHTP6UMCwLwToyGDH6a4+CrADPQB+zxs5oWQWf7nCVI0S3vQnlsgIAEq4w0aR YAKLU1UbAXySQO/3ZZ/PAKHLmfYi6PUwKrR41of4BdHdjqmsO9EfD4xUJV8NtQsaGo8I M9QVMa5eueIXgmkaL/IES+lJaMKb4iDusJ4yO/ZltqAzOFuo/1kEnHxYaEuZtfZa5MmL AQfTVdHcGp4BT8nDiuELJh7biowiyflH5FTwCLAPNx5dCyr9agicwIDS6zfiFmOn9H+w twgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730068503; x=1730673303; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bTKpU7tb6k7g67R2E6TGtP/hOf6u3m1LQ07VQt+VPxQ=; b=UpEeEOLXMwxgP5fp2QRxFX73yhHHMgHqGfmlNVCwJmc4XLqY35uVq6Yyswjn6KDNDK hnvM9yAaa6bBU8hfcsiEp/5iNo/WQ4z74DXv8rTMrr9Q2VjczFRxmQiIXs+qQ3pBtaZS W6NEjdbWnwXQi/02s69NZ9NoV0E9u5tGWkxSW4bp2idJyO7vcFJFFRzvANX36drXIyRz 7OvdhjUgsQ4DHS1vC8GyEH/uyorNjG95Lf14tuELCbpAad3m3A5+3VbDd5cRj67fOJh0 D1FcFho9DSqmId1PeHcIaITJZ/sRzN9LHz1f5wCvVnVmN0qapyGM9CxDaQTwoQBgWci3 v7oQ== X-Gm-Message-State: AOJu0YzHEAmZ8rxn67T0vgdIgqZc0lRjSpdpTrQSQzhMeSXQtn5rjlE6 6+yiWUSbjLw0NesEpePIQiNs3DUCH8eComg4c2LeZ2VVc6EaG8ZMbo9AhvXE X-Google-Smtp-Source: AGHT+IH7lH8spDqU5JECRb6mvViLKmtroTGCBlGvLNNHQ9BdBZZdMQmgz2hKLirjhYw/1ccZjRmK4w== X-Received: by 2002:a05:6602:2cc4:b0:835:4931:b110 with SMTP id ca18e2360f4ac-83b1c488fa5mr591698639f.5.1730068503279; Sun, 27 Oct 2024 15:35:03 -0700 (PDT) Received: from localhost (207-191-210-45.dhcp.imoncommunications.net. [207.191.210.45]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83b1384e826sm120378339f.42.2024.10.27.15.35.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2024 15:35:02 -0700 (PDT) From: Brandon Maier Date: Sun, 27 Oct 2024 17:34:56 -0500 Subject: [PATCH b4 v2 3/6] b4: handle trailers with improper formatting Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241027-trailer-special-chars-v2-3-e963f78b3ef8@gmail.com> References: <20241027-trailer-special-chars-v2-0-e963f78b3ef8@gmail.com> In-Reply-To: <20241027-trailer-special-chars-v2-0-e963f78b3ef8@gmail.com> To: "Kernel.org Tools" Cc: Brandon Maier , Konstantin Ryabitsev X-Mailer: b4 0.15-dev A patch trailer with an improperly formatted email parses to an empty string. For example see the linked github issue, where a trailer's display name contains an unquoted comma. As patch trailers are often hand written this can happen frequently. Try to gracefully handle this case by checking if an email parses correctly, and if it doesn't fallback to displaying it verbatim. Fixes: https://github.com/mricon/b4/issues/50 Signed-off-by: Brandon Maier --- src/b4/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/b4/__init__.py b/src/b4/__init__.py index 5115a9cd9b8746f84eb104a2be69fe121724167e..cf112e3bce2911c78cff18aac267608f796957ab 100644 --- a/src/b4/__init__.py +++ b/src/b4/__init__.py @@ -1063,8 +1063,10 @@ def __init__(self, name: Optional[str] = None, value: Optional[str] = None, exti # Normalize the value with parsed data if self.addr[0]: self.value = f'{self.addr[0]} <{self.addr[1]}>' - else: + elif self.addr[1]: self.value = self.addr[1] + else: + self.type = 'unknown' else: self.type = 'unknown' self.lname = self.name.lower() From patchwork Sun Oct 27 22:34:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Maier X-Patchwork-Id: 13852753 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C958417C61 for ; Sun, 27 Oct 2024 22:35:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730068506; cv=none; b=jdBsO+e1hy/R+Xoh+Ic2ZYubawvaoDgJO9dSJQWcqJK4z0xowFf4mSp7kjfdz/TnmMviMPD+tApxEMdv7E6To3pGwlv6j4P2piDZmRXnCnGEXFM7L9JMPJMWe1MiezxHdBCxIPX4f2tRcQ+z9opMV7g+JiK57JQCrg+rW0LCdb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730068506; c=relaxed/simple; bh=K+l16sqaq3lJf73NknBv3zEhSAGS6mixircG+nne7Qw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FDd2NfTS52vMQ+DN0Siwrsf1XDj38xbuvPCqh0Nhhg06Co2dEhpqnKbnvS+q6PmmMowksY0s3KccoA2vN6qo2R0rst1YexYehUD/k18V8dwMSe6ayNZg6s2ZDPHezgxUVDFuIvGpDr1+GHKz9zlCQmueFRpnnxsy9QcTWUWSPeA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QYRp93C3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QYRp93C3" Received: by smtp.kernel.org (Postfix) id B4736C4CEE4; Sun, 27 Oct 2024 22:35:06 +0000 (UTC) Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id D09C9C4CEC3 for ; Sun, 27 Oct 2024 22:35:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org D09C9C4CEC3 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-83abcfb9f37so144514739f.1 for ; Sun, 27 Oct 2024 15:35:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730068505; x=1730673305; darn=kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=D9CiP9VlwuLskIhfXi//tZDR9ko36YCjXLZj3JRThY8=; b=QYRp93C37mJXBKk207NxoGsJuqWxhtlocbrU1OZCN1yl/DUaic4bzX/ErBcUVigQeo 7vVIrcc/5HtJh/ui2G9wzmUI+SCcOgo1rJJkSWvsf/Y3NVJ8Q/WEX3HlZnqOeLAO/RAE UlCiN6by+s93DRB4/qGGvA/NosvXmTbPJfXWxfYIBlrGFrugFt0jjzSFQ/6OUQBn82bk EX/FVw9ikrPrxkjwmin1W96+4Rbu7qmJ+jFo2/bf9WJFZeH7EduPXL4mh/uZFgvLDwmd q2oqKGI8dFUGQvCKpUjW89aoqhvJ9oyb/0tfEbmcnhpwKhoqW73RdorTnKxsrmyQI61v ClNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730068505; x=1730673305; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D9CiP9VlwuLskIhfXi//tZDR9ko36YCjXLZj3JRThY8=; b=EzuSHzMLWumygz/fyHtT/ImBwOJQu8yaoIQTROpSGkCRJHkiunYVgjifMe5TAaC3Y+ 3aT8oHojVblvgScvxsrZf6DSv4wsnhVZVJZf5lKbCjghD9206QAphpWEX5IUMQs97q8o po2b7VWnV37a4qauekfo9Q8zppPVn9w948h4jzg6fqgpCYeooqafsdpFBDMsd2TTflx0 oaEF2XVFtcxneF0ZNVOfANMV6i0k3fDWcBgopyGGa7fDHmH9C6xvQq7PmnX/1H+vU9Vr hjpvVAz+X1+EIHm5NrCZbKn7g6ZeRoh3j/4qM4T0iPy2abCGdiJ2Qj3IJAG38KdAA6On AzRw== X-Gm-Message-State: AOJu0YzYY71iwlPC+r5CNsoZQFYYCo19aqucjUKRkx+XbrBSH0j1x1KL kLs6x9jpqm6t73OuLAumoiACIbZ0BElmpEDiGS9o/ZUY0qF1z6N3KZUuYGlY X-Google-Smtp-Source: AGHT+IEEwWaWsEytN4o8rxiEnrBSrr1DDlnsLJOrWA6jXrHRm9Lb3utjnqwKkb/MMCynMVGj1dShnA== X-Received: by 2002:a05:6e02:1c4e:b0:3a2:7651:9878 with SMTP id e9e14a558f8ab-3a4ed2aff10mr53521905ab.12.1730068504757; Sun, 27 Oct 2024 15:35:04 -0700 (PDT) Received: from localhost (207-191-210-45.dhcp.imoncommunications.net. [207.191.210.45]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a4e6de094dsm13518645ab.33.2024.10.27.15.35.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2024 15:35:04 -0700 (PDT) From: Brandon Maier Date: Sun, 27 Oct 2024 17:34:57 -0500 Subject: [PATCH b4 v2 4/6] src/tests: test for trailers with improper formatting Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241027-trailer-special-chars-v2-4-e963f78b3ef8@gmail.com> References: <20241027-trailer-special-chars-v2-0-e963f78b3ef8@gmail.com> In-Reply-To: <20241027-trailer-special-chars-v2-0-e963f78b3ef8@gmail.com> To: "Kernel.org Tools" Cc: Brandon Maier , Konstantin Ryabitsev X-Mailer: b4 0.15-dev Check that a trailer with an improperly formatted email address will still parse to something usable. Signed-off-by: Brandon Maier --- src/tests/samples/trailers-test-extinfo.txt | 1 + src/tests/test___init__.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tests/samples/trailers-test-extinfo.txt b/src/tests/samples/trailers-test-extinfo.txt index aa61e8d635923c2e2539b82c60f69b489ad7cee3..5417cdd87bfdf4ddb278e125a6dd04d2e86af141 100644 --- a/src/tests/samples/trailers-test-extinfo.txt +++ b/src/tests/samples/trailers-test-extinfo.txt @@ -4,6 +4,7 @@ Date: Tue, 30 Aug 2022 11:19:07 -0400 This is a simple trailer parsing test. +Reported-by: Some, One Reviewed-by: Bogus Bupkes [for the parts that are bogus] Fixes: abcdef01234567890 diff --git a/src/tests/test___init__.py b/src/tests/test___init__.py index 7fe43b0158460f06d0a2b52d2689d26e7ef7f840..85ccd190677daebc30b9987eb811d44a15dce79b 100644 --- a/src/tests/test___init__.py +++ b/src/tests/test___init__.py @@ -62,7 +62,8 @@ def test_save_git_am_mbox(sampledir, tmp_path, source, regex, flags, ismbox): ('utility', 'Link', 'https://msgid.link/some@msgid.here', None), ]), ('trailers-test-extinfo', - [('person', 'Reviewed-by', 'Bogus Bupkes ', '[for the parts that are bogus]'), + [('unknown', 'Reported-by', 'Some, One ', None), + ('person', 'Reviewed-by', 'Bogus Bupkes ', '[for the parts that are bogus]'), ('utility', 'Fixes', 'abcdef01234567890', None), ('person', 'Tested-by', 'Some Person ', ' [this person visually indented theirs]'), ('utility', 'Link', 'https://msgid.link/some@msgid.here', ' # initial submission'), From patchwork Sun Oct 27 22:34:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Maier X-Patchwork-Id: 13852754 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4E5A717C61 for ; Sun, 27 Oct 2024 22:35:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730068508; cv=none; b=n0rw0SVgH/qy6InvVK1/5/eQBQRIxh6lhZnb9kycUckhtQWC1wz8MqlGoJbn3E84hDczJP7Hu98BopoWQQqzRwIYa1iCWzatcNA1imExSFRYCFwGhzvaLj9AB0TxYU5VQF+BFJ66BAln/Lq1gpOgElYi+uPhiC2JLyH/7zqz2Hk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730068508; c=relaxed/simple; bh=thCIny0xdSEb3Ln2jH1SbxowWtegy/WhlByPuh253ZY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HlNo8icHxqrOztrhbCwepRHHaBsKHecPYXJxFEHrhsfk4YrXN0fAqQA/0yUdXCcPsLgEdZRZvYc9HCyzKTfYWW5B527pGxrHVTRwpGtBFBafeNOqJ3+zOxgcjZN40WGM6AjZRcazINtOiGgYTqCae6GuZCsR9ryWGPyDdQWKOg0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mn9w5ztu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mn9w5ztu" Received: by smtp.kernel.org (Postfix) id 00CD4C4CEE4; Sun, 27 Oct 2024 22:35:08 +0000 (UTC) Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 1349DC4CEC3 for ; Sun, 27 Oct 2024 22:35:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 1349DC4CEC3 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-83ab00438acso104394239f.0 for ; Sun, 27 Oct 2024 15:35:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730068506; x=1730673306; darn=kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=NqO48nwk3iU6ftYH6BC4N8HDnAY5f1TAntteR8wnKDY=; b=mn9w5ztudHkJzCwNPlaU+b5qh0rGCDBGnUF7X3Y26RQOEI/+mI/wuGE1bnQlsWgBtT pPgg3issYHVP7rbzdAETocD2Z7ljqiJzAMvo9pWfvt8DvHDckY27ValaWcmtkFQBq04F pl5xIE6AlQoaA85QWwoVK8IAZARBTtF6rI+Ba+1NENHxYO4ZYJ5qjPmSJ60AVa4V5qdB PpiaGgSnbI/ngC4H1nnCp0mb1c8MPxSTa7DUQ1LrnUFTY9gy5UQQ+7TNQrxIpTSPo4EJ 4HQR5AnagQNjc8plrxaSD7AZFOYY84risYuorvM5pLFm9rSBQwTKzGuSUAc/av1e+mlD sDVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730068506; x=1730673306; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NqO48nwk3iU6ftYH6BC4N8HDnAY5f1TAntteR8wnKDY=; b=On11uIm1U9cIeak4s9bsY6NdT8yyhbA/kcKk8vEMWUif8kSKB8AhrIJa4NWCw/cysy 0rOaKM/EWy9OAqgAmcs+bZ+NM6ha8xbVCEgBPLt2Cpqles1Q6WPBF2dhYEW1AVmBmCJP iUKIYt4hrF59wmDLioOE8MQhYFTuL8ZG8KI3HbSeRBjbv00zEdl2S6riUk+nRDami4hp MT8DiDSO1eSiMGQipOjvUxqvNTvT3be5s89hAYXiz4hzX9CrjPh3ayDf3LFmH9m9U7wO yUy1NDLbd793Z8s3aQLCaA0zCEvXPPXWJlVA1aUWXdjMhc7EUKzCSlPg+JY7sHq+0eZ/ UUcw== X-Gm-Message-State: AOJu0YyFdV4HPNiDQOmu9pjMjBCQuH11SqVn/A4QISV5W1zhnhTlsHKP +MFOv4ux/RHpcmmkx6cg68Ip2gR/Sa/t7EGyk7VkVSntWYgDJmF2NaDRijcs X-Google-Smtp-Source: AGHT+IGkE6zq8I12kzS+ByrS2raPLhAfUJwhMHmNsElEAfR0eXbzjLQa1LiS3yq+/CKCg39vrPkZGg== X-Received: by 2002:a05:6602:2754:b0:835:39a8:e201 with SMTP id ca18e2360f4ac-83b0406aeddmr850604339f.0.1730068506216; Sun, 27 Oct 2024 15:35:06 -0700 (PDT) Received: from localhost (207-191-210-45.dhcp.imoncommunications.net. [207.191.210.45]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83b137de1efsm124278939f.15.2024.10.27.15.35.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2024 15:35:05 -0700 (PDT) From: Brandon Maier Date: Sun, 27 Oct 2024 17:34:58 -0500 Subject: [PATCH b4 v2 5/6] b4: handle trailers with special characters Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241027-trailer-special-chars-v2-5-e963f78b3ef8@gmail.com> References: <20241027-trailer-special-chars-v2-0-e963f78b3ef8@gmail.com> In-Reply-To: <20241027-trailer-special-chars-v2-0-e963f78b3ef8@gmail.com> To: "Kernel.org Tools" Cc: Brandon Maier , Konstantin Ryabitsev X-Mailer: b4 0.15-dev Parsing an email trailer with special characters breaks the formatting. For example this trailer. > Reviewed-by: "Doe, Jane" Will get parsed into this. > Reviewed-by: Doe, Jane This is because b4.LoreTrailer attempts to reformat the trailer using a naive string format. Instead use the Python standard library formataddr function which correctly handles special characters. Signed-off-by: Brandon Maier --- src/b4/__init__.py | 6 ++---- src/tests/samples/trailers-followup-bare-address-ref-defaults.txt | 2 +- src/tests/samples/trailers-followup-name-parens-ref-defaults.txt | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/b4/__init__.py b/src/b4/__init__.py index cf112e3bce2911c78cff18aac267608f796957ab..0785be8ffcef08fb5cd4c484a40e6fe856446cfe 100644 --- a/src/b4/__init__.py +++ b/src/b4/__init__.py @@ -1061,10 +1061,8 @@ def __init__(self, name: Optional[str] = None, value: Optional[str] = None, exti self.type = 'person' self.addr = email.utils.parseaddr(value) # Normalize the value with parsed data - if self.addr[0]: - self.value = f'{self.addr[0]} <{self.addr[1]}>' - elif self.addr[1]: - self.value = self.addr[1] + if self.addr[0] or self.addr[1]: + self.value = email.utils.formataddr(self.addr) else: self.type = 'unknown' else: diff --git a/src/tests/samples/trailers-followup-bare-address-ref-defaults.txt b/src/tests/samples/trailers-followup-bare-address-ref-defaults.txt index 7b1ebef3c9d9b9c60288dc07bcf7f82f066c6934..82e1576019bd9f4d69f9a2ed9b783340a5ea16b2 100644 --- a/src/tests/samples/trailers-followup-bare-address-ref-defaults.txt +++ b/src/tests/samples/trailers-followup-bare-address-ref-defaults.txt @@ -14,7 +14,7 @@ Cc: bare-address@example.org Reviewed-by: Original Reviewer Link: https://msgid.link/some@msgid.here Signed-off-by: Original Submitter -Reviewed-by: Followup Reviewer1 (corporate) +Reviewed-by: "Followup Reviewer1 (corporate)" Tested-by: Followup Reviewer2 diff --git a/b4/junk.py b/b4/junk.py diff --git a/src/tests/samples/trailers-followup-name-parens-ref-defaults.txt b/src/tests/samples/trailers-followup-name-parens-ref-defaults.txt index 06b883126bd3ea9f7a4d22c58fc10e9e89d6bde7..dfc013c89c415107ff2517c1715e523982df2afc 100644 --- a/src/tests/samples/trailers-followup-name-parens-ref-defaults.txt +++ b/src/tests/samples/trailers-followup-name-parens-ref-defaults.txt @@ -13,7 +13,7 @@ Fixes: abcdef01234567890 Reviewed-by: Original Reviewer Link: https://msgid.link/some@msgid.here Signed-off-by: Original Submitter -Reviewed-by: Followup Reviewer1 (corporate) +Reviewed-by: "Followup Reviewer1 (corporate)" Tested-by: Followup Reviewer2 diff --git a/b4/junk.py b/b4/junk.py From patchwork Sun Oct 27 22:34:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Maier X-Patchwork-Id: 13852755 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A02BB17C61 for ; Sun, 27 Oct 2024 22:35:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730068509; cv=none; b=HCY3cGZu93XqLcPAMIGmxYvsJo24ajJpWFX8r+7jOI7bGUHNGNhjOzGXZ2kT/SE0uQjwCOTtbAKSOMuTwQI4+NuAqgFAT6t9omF9CzMJDb4dldWMJzoV7hVGCHKrAmp0lkb6DQpq2vyrdn9WDWtDW1YRXQS67D29lBFfdyrCr+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730068509; c=relaxed/simple; bh=mdjk1FASx8K9Fca5g8HKWaki5BgvEPiAlQXaqr3NPec=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ImCKBBY7aQU5wOVjnmiyvpxLP4gY4O7apa+L5ZZt3U+Jvqlbce4Iq7QJu+SXP48MWK5YME8KxYd+JXw/rhD3fzICk6IYRlzMR0ogDhJ9WvQSWpzRJD7PEdHTGgW4B63bnbP7i6T4KOiaV65kaNZWxMCBRbC+0r41Vgsc6Rg4VFI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Mtq0dHwY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Mtq0dHwY" Received: by smtp.kernel.org (Postfix) id 4E3B0C4CEC3; Sun, 27 Oct 2024 22:35:09 +0000 (UTC) Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 6759EC4CEE5 for ; Sun, 27 Oct 2024 22:35:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 6759EC4CEE5 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-io1-f45.google.com with SMTP id ca18e2360f4ac-83abc039b25so144162039f.0 for ; Sun, 27 Oct 2024 15:35:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730068507; x=1730673307; darn=kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=vJrWISz0Xuvy0CmSlmkPNOkC1LDH7C1+EXPLkzYe154=; b=Mtq0dHwYlL3MoiXOk7JsyZPFMiq5Li02XBUcBV25VAHx+cjmS7nFTKmAk2f0MxEZcm Rlw3CuKIALPnnMEIHOutAGmIbTVbu/IveUAdGjegAuxjQwnLSFUNRErCjOAsJMviEfMd n2M2axDWG4ybykNO1iTAM6NpdBeYpAefhfOkQYUibrRChOGmXJLd+2KAFTEG6LVE3iK0 KQ4FRLYBLwF10WjTd0Woqa3V2Akhak3/4iBsDXWtWr55OpktmE6dqRL0HMly0bfHUiCs fl97CfjEeIYAZ7ne+Sw75Vjq/sKvdWQrKbe4ZItDou+jLRI1Nu/zYThkIwfFAo7SZ0iQ HzEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730068507; x=1730673307; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vJrWISz0Xuvy0CmSlmkPNOkC1LDH7C1+EXPLkzYe154=; b=S6oeMZPFNr6leVeKXdHc0a6Y2Pfm1uXH8sFiVjxlkUMGWCXengizGOWA87PDh90WXy YLgPtrgbD+tyNc/deT5t3q2jrPtMIq7NgbnV2zdqLVX8tlLXsy4cKj37J3pMv5OkM21y 21r3MEduX4ihAflRzvk42vPtf9HMscnNt9kwZeaug6aoMmjGuex6UhCxTsjBM3J3eZPp cLyLb8DR6YhDtmSei/eAW/xJTXErvD1rZ7N8qeHtIB/I/CqtQvmaWKJ2UYp+8yufhyLt TdHzxruiaT/kIN5EXBvURSn9cg9T8enbJORH3T+7B0Wc6WQ6KcNkQBamTI+dy9y2raHq 8vgA== X-Gm-Message-State: AOJu0Yxd7NW/h/CeKVQxq2UEUJhQmbE47xOOmmy8gnfMiE24TqbLjl9H YnxGKSE8PTFUVsHcJWYnqL8WA4G4OJ0xZVVm5Gtk9O9rTOTPVPq3Jf7MFDMu X-Google-Smtp-Source: AGHT+IFBOoJbVwsn5tV+0uIuzqoQuybLA0S4m1r90Lf8zjYZaBtzZvkAZbeFYokNZRlu14X49KAuBA== X-Received: by 2002:a05:6602:2c95:b0:82c:f8fb:2c23 with SMTP id ca18e2360f4ac-83b1c607e2dmr450051139f.15.1730068507351; Sun, 27 Oct 2024 15:35:07 -0700 (PDT) Received: from localhost (207-191-210-45.dhcp.imoncommunications.net. [207.191.210.45]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83b137c9996sm116080839f.1.2024.10.27.15.35.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2024 15:35:06 -0700 (PDT) From: Brandon Maier Date: Sun, 27 Oct 2024 17:34:59 -0500 Subject: [PATCH b4 v2 6/6] src/tests: test for trailers with special characters Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241027-trailer-special-chars-v2-6-e963f78b3ef8@gmail.com> References: <20241027-trailer-special-chars-v2-0-e963f78b3ef8@gmail.com> In-Reply-To: <20241027-trailer-special-chars-v2-0-e963f78b3ef8@gmail.com> To: "Kernel.org Tools" Cc: Brandon Maier , Konstantin Ryabitsev X-Mailer: b4 0.15-dev Test that email trailers with special characters are parsed correctly. Signed-off-by: Brandon Maier --- src/tests/samples/trailers-test-simple.txt | 1 + src/tests/test___init__.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tests/samples/trailers-test-simple.txt b/src/tests/samples/trailers-test-simple.txt index da64caff8dfaa0cbc630c8ae3515f4508cfd0764..a82416354012d3c32f99b39d1918ac343f2b66cc 100644 --- a/src/tests/samples/trailers-test-simple.txt +++ b/src/tests/samples/trailers-test-simple.txt @@ -4,6 +4,7 @@ Date: Tue, 30 Aug 2022 11:19:07 -0400 This is a simple trailer parsing test. +Reported-by: "Doe, Jane" Reviewed-by: Bogus Bupkes Fixes: abcdef01234567890 Link: https://msgid.link/some@msgid.here diff --git a/src/tests/test___init__.py b/src/tests/test___init__.py index 85ccd190677daebc30b9987eb811d44a15dce79b..a4637b9c797367da462f062511fdf4e018a5b81e 100644 --- a/src/tests/test___init__.py +++ b/src/tests/test___init__.py @@ -57,7 +57,8 @@ def test_save_git_am_mbox(sampledir, tmp_path, source, regex, flags, ismbox): @pytest.mark.parametrize('source,expected', [ ('trailers-test-simple', - [('person', 'Reviewed-by', 'Bogus Bupkes ', None), + [('person', 'Reported-by', '"Doe, Jane" ', None), + ('person', 'Reviewed-by', 'Bogus Bupkes ', None), ('utility', 'Fixes', 'abcdef01234567890', None), ('utility', 'Link', 'https://msgid.link/some@msgid.here', None), ]),