From 1994bb27cff3468816ad919803e7576eae259b26 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Thu, 8 Nov 2018 11:09:10 +0100 Subject: PatchSeries: Only pass patch description and header to git-mailinfo There are patches around that use Content-Transfer-Encoding: base64 but the actual patch after '---' is unencoded ascii resulting in garbage after the patch description when imported into a patch queue. Since we're discarding the patch part of git-mailinfo anyway don't pass this on in the first place. Closes: #912426 --- tests/08_test_patch.py | 24 ++++++++++++++++++++++++ tests/08_test_patch_data/base64.patch | 25 +++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 tests/08_test_patch_data/base64.patch (limited to 'tests') diff --git a/tests/08_test_patch.py b/tests/08_test_patch.py index c0f3e5ce..1567f018 100644 --- a/tests/08_test_patch.py +++ b/tests/08_test_patch.py @@ -102,3 +102,27 @@ usbip_common.c has the same problem. Signed-off-by: Ben Hutchings """, p.long_desc) + + +class TestBase64Patch(unittest.TestCase): + data_dir = os.path.splitext(__file__)[0] + '_data' + + def test_parse(self): + """Get patch information from git mailimport with base64 body but plain text patch""" + patchfile = os.path.join(self.data_dir, "base64.patch") + self.assertTrue(os.path.exists(patchfile)) + p = Dep3Patch(patchfile) + self.assertEqual("Sort files in archive (reproducible builds)", p.subject) + self.assertEqual("Nick Leverton", p.author) + self.assertEqual("nick@leverton.org", p.email) + self.assertEqual("""\ +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: base64 + +Sort files when using mergelib to create libnullmailer.a, to get +reproducible build + +Author: Alexis Bienvenüe +""", + p.long_desc) diff --git a/tests/08_test_patch_data/base64.patch b/tests/08_test_patch_data/base64.patch new file mode 100644 index 00000000..c267be82 --- /dev/null +++ b/tests/08_test_patch_data/base64.patch @@ -0,0 +1,25 @@ +From: Nick Leverton +Date: Tue, 11 Jul 2017 22:25:43 -0300 +Subject: Sort files in archive (reproducible builds) +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: base64 + +U29ydCBmaWxlcyB3aGVuIHVzaW5nIG1lcmdlbGliIHRvIGNyZWF0ZSBsaWJudWxsbWFpbGVyLmEs +IHRvIGdldApyZXByb2R1Y2libGUgYnVpbGQKCkF1dGhvcjogQWxleGlzIEJpZW52ZW7DvGUgPHBh +ZG9AcGFzc29pcmUuZnI+Cg== +--- + lib/mergelib.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/mergelib.sh b/lib/mergelib.sh +index f9b7a94..4e71079 100644 +--- a/lib/mergelib.sh ++++ b/lib/mergelib.sh +@@ -12,5 +12,5 @@ for input in "$@"; do + "${AR:-ar}" x ../../"$input" + cd .. + done +-"${AR:-ar}" rc ../"$archive" */* ++"${AR:-ar}" rc ../"$archive" `LC_ALL=C ls */*` + "${RANLIB:-ranlib}" ../"$archive" -- cgit v1.2.3