{"thread":{"id":"54983","subject":"git am fails because of weird text in commit log","startedAt":"2021-01-13T14:03:13Z","lastAt":"2021-01-13T20:34:05Z","messageCount":2,"participants":["Michael S. Tsirkin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"414263","messageId":"20210113085846-mutt-send-email-mst@kernel.org","threadId":"54983","inReplyTo":null,"subject":"git am fails because of weird text in commit log","fromName":"Michael S. Tsirkin","fromEmail":"mst@redhat.com","sentAt":"2021-01-13T14:01:16Z","receivedAt":"2021-01-13T14:03:13Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Hi guys!\nSo someone sends me a patch with --- in the commit log, like this below.\nResult: git am gets confused and can't apply the patch.\nShouldn't git format-patch at least complain about commit log\nlike this, if not mangle it in some way?\n\nThanks!\n\n----- Forwarded message from Jiahui Cen <cenjiahui@huawei.com> -----\n\nReturn-Path: cenjiahui@huawei.com\nReceived: from mail.corp.redhat.com [10.4.203.66]\n\tby tuck.redhat.com with IMAP (fetchmail-6.4.14 polling redhat account mtsirkin)\n\tfor <mst@localhost> (single-drop); Thu, 07 Jan 2021 06:43:47 -0500 (EST)\nReceived: from zmta04.collab.prod.int.phx2.redhat.com (LHLO\n\tzmta04.collab.prod.int.phx2.redhat.com) (10.5.81.11) by\n\tzmail25.collab.prod.int.phx2.redhat.com with LMTP; Thu, 7 Jan 2021 06:43:30\n\t-0500 (EST)\nReceived: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3])\n\tby zmta04.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 29925D192E\n\tfor <mtsirkin@mail.corp.redhat.com>; Thu,  7 Jan 2021 06:43:30 -0500 (EST)\nReceived: by smtp.corp.redhat.com (Postfix)\n\tid F329610FFE73; Thu,  7 Jan 2021 11:43:29 +0000 (UTC)\nDelivered-To: mtsirkin@redhat.com\nReceived: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id EEF0A1008B7C\n\tfor <mtsirkin@redhat.com>; Thu,  7 Jan 2021 11:43:29 +0000 (UTC)\nReceived: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby mimecast-mx02.redhat.com (Postfix) with ESMTPS id DE23A8007D9\n\tfor <mtsirkin@redhat.com>; Thu,  7 Jan 2021 11:43:29 +0000 (UTC)\nARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=dkim.mimecast.com; s=201903; t=1610019809;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=7xCM6kqgaZVYVmLgjlhzpVio7ybFFGY+vI8JLzIs3vw=;\n\tb=JAZFv2+n3oG0ywJT4mRDovwnjEYv1xBJTtIr/86qaa9GJfLbwHn9eH+HMjcpiZa1Ayli1A\n\t9Z67hv85lHhczbEoqxWHkX4iQauDRYkI5IJuvGfld2nW6qxpAeQdCGOm8aRlZn4vSqn9AN\n\tqOWYmzHd5UnRVmATlnkidDCzFK4EH5G5ailMHwOseMD0MbPy7PzlLScsWL8pIiCIL8qYLn\n\tUPXYmOk/9s3Xba4w+Vwx0boLiDLN/Uz+rKEvYudsXmmZhE2iq42njp8NtCkvYRyzZ2UNzI\n\t36R/aAQiHdB4+6ydIcohWat/zIlrmKhOx8tY8ErwK1YJvxpT9SyRfaiDXH+saw==\nARC-Seal: i=1; s=201903; d=dkim.mimecast.com; t=1610019809; a=rsa-sha256;\n\tcv=none;\n\tb=IYWl2HjYEs9WxfpF0FSP4+0osN30yVCTxn8HwP4uOb/oQwH6Z2q3Be3GAzW1VlwcW+1RHg\n\t6XC28GjxS0FrcGUzAeMMKUnyApWcmjnpjs48oJP+5lFn199Vl3aiAV/SkA2J3j3F9+QxGF\n\tyfFtlWwrgRbXPQfwj42T+58bfmvSEFuOZzdskOit0ng9qgf9d9jFDLC3OlxoNFBU5Y88u+\n\tM587dKRSPZl81xG8aYIcbdXU+kfsdalC+hHC13CCbxvQnduKx5gHQxX0cxYTEhOfY4sare\n\t+yJFPrmgTdHrA3Wp9nb9p+zCimnVNH3NQjZoP6mEp4DJgTgTy21XyPqcGybjMA==\nARC-Authentication-Results: i=1;\n\trelay.mimecast.com;\n\tdkim=none;\n\tdmarc=none;\n\tspf=pass (relay.mimecast.com: domain of cenjiahui@huawei.com designates 45.249.212.191 as permitted sender)\n\tsmtp.mailfrom=cenjiahui@huawei.com\nReceived: from szxga05-in.huawei.com (szxga05-in.huawei.com\n\t[45.249.212.191]) (Using TLS) by relay.mimecast.com with ESMTP id\n\tus-mta-379-O4GKzptQMXyigWpxPtEsjA-1; Thu, 07 Jan 2021 06:43:23 -0500\nX-MC-Unique: O4GKzptQMXyigWpxPtEsjA-1\nReceived: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60])\n\tby szxga05-in.huawei.com (SkyGuard) with ESMTP id 4DBPV46PZlzj4Zx;\n\tThu,  7 Jan 2021 19:42:20 +0800 (CST)\nReceived: from localhost (10.174.184.155) by DGGEMS407-HUB.china.huawei.com\n\t(10.3.19.207) with Microsoft SMTP Server id 14.3.498.0; Thu, 7 Jan 2021\n\t19:43:06 +0800\nFrom: Jiahui Cen <cenjiahui@huawei.com>\nTo: qemu-devel@nongnu.org\nCC: \"Michael S. Tsirkin\" <mst@redhat.com>,\n\tIgor Mammedov <imammedo@redhat.com>,\n\tMarcel Apfelbaum <marcel.apfelbaum@gmail.com>,\n\tPaolo\n\tBonzini <pbonzini@redhat.com>,\n\tRichard Henderson <richard.henderson@linaro.org>,\n\tEduardo Habkost <ehabkost@redhat.com>,\n\tLaszlo Ersek <lersek@redhat.com>,\n\tArd Biesheuvel <ard.biesheuvel@arm.com>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\txieyingtai@huawei.com, wu.wubin@huawei.com,\n\tJiahui Cen <cenjiahui@huawei.com>\nSubject: [PATCH v4 2/8] acpi: Fix unmatched expected DSDT.pxb file\nDate: Thu, 7 Jan 2021 19:40:37 +0800\nMessage-ID: <20210107114043.9624-3-cenjiahui@huawei.com>\nIn-Reply-To: <20210107114043.9624-1-cenjiahui@huawei.com>\nReferences: <20210107114043.9624-1-cenjiahui@huawei.com>\nMIME-Version: 1.0\nX-Originating-IP: [10.174.184.155]\nX-CFilter-Loop: Reflected\nAuthentication-Results: relay.mimecast.com;\n\tdkim=none;\n\tdmarc=none;\n\tspf=pass (relay.mimecast.com: domain of cenjiahui@huawei.com designates 45.249.212.191 as permitted sender)\n\tsmtp.mailfrom=cenjiahui@huawei.com\nX-Mimecast-Spam-Score: 3\nX-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition;Similar Internal Domain=false;Similar Monitored\n\tExternal Domain=false;Custom External Domain=false;Mimecast External Domain=false;Newly Observed Domain=false;Internal User\n\tName=false;Custom Display Name List=false;Reply-to Address Mismatch=false;Targeted Threat Dictionary=false;Mimecast Threat\n\tDictionary=false;Custom Threat Dictionary=false\nContent-Type: text/plain\nContent-Transfer-Encoding: quoted-printable\nX-Scanned-By: MIMEDefang 2.78 on 10.11.54.3\nStatus: RO\nContent-Length: 7858\nLines: 189\n\nCommit fe1127da11 (\"unit-test: Add the binary file and clear diff.h\") does not\nuse the up-to-date expected file for pxb for ARM virt.\n\nFix the expected DSDT.pxb file.\n\nFull diff of changed file disassembly:\n\ndiff -ru /tmp/old/tests/data/acpi/virt/DSDT.pxb.dsl /tmp/new/tests/data/acpi/virt/DSDT.pxb.dsl\n--- /tmp/old/tests/data/acpi/virt/DSDT.pxb.dsl  2021-01-07 17:04:51.246831080 +0800\n+++ /tmp/new/tests/data/acpi/virt/DSDT.pxb.dsl  2021-01-07 17:11:59.566831080 +0800\n@@ -9,9 +9,9 @@\n  *\n  * Original Table Header:\n  *     Signature        \"DSDT\"\n- *     Length           0x00001E7A (7802)\n+ *     Length           0x00001DF9 (7673)\n  *     Revision         0x02\n- *     Checksum         0x57\n+ *     Checksum         0x42\n  *     OEM ID           \"BOCHS \"\n  *     OEM Table ID     \"BXPCDSDT\"\n  *     OEM Revision     0x00000001 (1)\n@@ -45,32 +45,6 @@\n             })\n         }\n\n-        Device (FLS0)\n-        {\n-            Name (_HID, \"LNRO0015\")  // _HID: Hardware ID\n-            Name (_UID, Zero)  // _UID: Unique ID\n-            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings\n-            {\n-                Memory32Fixed (ReadWrite,\n-                    0x00000000,         // Address Base\n-                    0x04000000,         // Address Length\n-                    )\n-            })\n-        }\n-\n-        Device (FLS1)\n-        {\n-            Name (_HID, \"LNRO0015\")  // _HID: Hardware ID\n-            Name (_UID, One)  // _UID: Unique ID\n-            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings\n-            {\n-                Memory32Fixed (ReadWrite,\n-                    0x04000000,         // Address Base\n-                    0x04000000,         // Address Length\n-                    )\n-            })\n-        }\n-\n         Device (FWCF)\n         {\n             Name (_HID, \"QEMU0002\")  // _HID: Hardware ID\n@@ -665,9 +639,6 @@\n         {\n             Name (_HID, \"PNP0A08\" /* PCI Express Bus */)  // _HID: Hardware ID\n             Name (_CID, \"PNP0A03\" /* PCI Bus */)  // _CID: Compatible ID\n-            Name (_ADR, Zero)  // _ADR: Address\n-            Name (_CCA, One)  // _CCA: Cache Coherency Attribute\n-            Name (_SEG, Zero)  // _SEG: PCI Segment\n             Name (_BBN, 0x80)  // _BBN: BIOS Bus Number\n             Name (_UID, 0x80)  // _UID: Unique ID\n             Name (_STR, Unicode (\"pxb Device\"))  // _STR: Description String\n@@ -1857,7 +1828,7 @@\n             Name (_CID, \"PNP0A03\" /* PCI Bus */)  // _CID: Compatible ID\n             Name (_SEG, Zero)  // _SEG: PCI Segment\n             Name (_BBN, Zero)  // _BBN: BIOS Bus Number\n-            Name (_UID, \"PCI0\")  // _UID: Unique ID\n+            Name (_UID, Zero)  // _UID: Unique ID\n             Name (_STR, Unicode (\"PCIe 0 Device\"))  // _STR: Description String\n             Name (_CCA, One)  // _CCA: Cache Coherency Attribute\n             Name (_PRT, Package (0x80)  // _PRT: PCI Routing Table\n@@ -2983,41 +2954,37 @@\n                 Return (0x0000004010000000)\n             }\n\n-            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings\n+            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings\n             {\n-                Return (ResourceTemplate ()\n-                {\n-                    WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,\n-                        0x0000,             // Granularity\n-                        0x0000,             // Range Minimum\n-                        0x007F,             // Range Maximum\n-                        0x0000,             // Translation Offset\n-                        0x0080,             // Length\n-                        ,, )\n-                    DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,\n-                        0x00000000,         // Granularity\n-                        0x10000000,         // Range Minimum\n-                        0x3EFEFFFF,         // Range Maximum\n-                        0x00000000,         // Translation Offset\n-                        0x2EFF0000,         // Length\n-                        ,, , AddressRangeMemory, TypeStatic)\n-                    DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,\n-                        0x00000000,         // Granularity\n-                        0x00000000,         // Range Minimum\n-                        0x0000FFFF,         // Range Maximum\n-                        0x3EFF0000,         // Translation Offset\n-                        0x00010000,         // Length\n-                        ,, , TypeStatic, DenseTranslation)\n-                    QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,\n-                        0x0000000000000000, // Granularity\n-                        0x0000008000000000, // Range Minimum\n-                        0x000000FFFFFFFFFF, // Range Maximum\n-                        0x0000000000000000, // Translation Offset\n-                        0x0000008000000000, // Length\n-                        ,, , AddressRangeMemory, TypeStatic)\n-                })\n-            }\n-\n+                WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,\n+                    0x0000,             // Granularity\n+                    0x0000,             // Range Minimum\n+                    0x007F,             // Range Maximum\n+                    0x0000,             // Translation Offset\n+                    0x0080,             // Length\n+                    ,, )\n+                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,\n+                    0x00000000,         // Granularity\n+                    0x10000000,         // Range Minimum\n+                    0x3EFEFFFF,         // Range Maximum\n+                    0x00000000,         // Translation Offset\n+                    0x2EFF0000,         // Length\n+                    ,, , AddressRangeMemory, TypeStatic)\n+                DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,\n+                    0x00000000,         // Granularity\n+                    0x00000000,         // Range Minimum\n+                    0x0000FFFF,         // Range Maximum\n+                    0x3EFF0000,         // Translation Offset\n+                    0x00010000,         // Length\n+                    ,, , TypeStatic, DenseTranslation)\n+                QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,\n+                    0x0000000000000000, // Granularity\n+                    0x0000008000000000, // Range Minimum\n+                    0x000000FFFFFFFFFF, // Range Maximum\n+                    0x0000000000000000, // Translation Offset\n+                    0x0000008000000000, // Length\n+                    ,, , AddressRangeMemory, TypeStatic)\n+            })\n             Name (SUPP, Zero)\n             Name (CTRL, Zero)\n             Method (_OSC, 4, NotSerialized)  // _OSC: Operating System Capabilities\n\nFixes: fe1127da11 (\"unit-test: Add the binary file and clear diff.h\")\nSigned-off-by: Jiahui Cen <cenjiahui@huawei.com>\n---\n tests/data/acpi/virt/DSDT.pxb | Bin 7802 -> 7673 bytes\n 1 file changed, 0 insertions(+), 0 deletions(-)\n\ndiff --git a/tests/data/acpi/virt/DSDT.pxb b/tests/data/acpi/virt/DSDT.pxb\nindex d5f0533a02d62bc2ae2db9b9de9484e5c06652fe..76f5f1c2fd487644c6b4f827a70ad770edb9fdc9 100644\nGIT binary patch\ndelta 70\nzcmV-M0J;DAJo!5cL{mgm`5gcN0z#1r8v=ygktblW?YIa6OPZ6X2_m!G35f{>PNz^q\ncNt3DxACrg^53`&Ttq27OUqez;vr-%=0*oRUFaQ7m\n\ndelta 217\nzcmexq{mX{SCD<jTN{)enDSRTAG*j!-iRuaUhHgH=1|0Doo-VvTenI{Q28N~#9Py!^\nzE<n;bC|FRCi?5B7fsp|MSSlH!n?PC&v1wsM*TMqS1=eEW7Vhi@(GuwD8){%+U<5Qj\nzIK*+|g83XwzOyGgaw_pVx&(nNb#?@r6YT1~If1i>lgWL><aa`bth@ovo(7xch1YU$\nQia3I;VOX;HqO=AR0CN5_Pyhe`\n\n-- \n2.29.2\n\n----- End forwarded message -----\n\n"},{"id":"414288","messageId":"xmqqzh1cwp9q.fsf@gitster.c.googlers.com","threadId":"54983","inReplyTo":"20210113085846-mutt-send-email-mst@kernel.org","subject":"Re: git am fails because of weird text in commit log","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-01-13T20:33:21Z","receivedAt":"2021-01-13T20:34:05Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@redhat.com> writes:\n\n> So someone sends me a patch with --- in the commit log, like this below.\n> Result: git am gets confused and can't apply the patch.\n\nQuite understandable.\n\n> Shouldn't git format-patch at least complain about commit log\n> like this, if not mangle it in some way?\n\nIt probably is too early to warn, mangle or quote in \"git commit\".\nI agree with you that \"git format-patch\" would be the best step in a\ntypical workflow to warn, mangle or quote.\n\nThe solution would probably begin with identifying the lines in the\ncommit log that mailinfo.c::patchbreak() considers the beginning of\nthe patch part.  After finding such a line:\n\n - Warning is easy.  \n\n - Mangling the line by prefixing something like \" \" in front of it\n   would also be easy.\n\n - Quoting thru to the end of \"patch that shouldn't have been there\"\n   in possibly a reversible way is probably too hard.\n\nMangling or quoting should be hidden behind an option, I would\nthink.\n\nPatches welcome.\n\nThanks.\n"}]}