git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] [BUG] test_expect_failure mailinfo -b fatals

From
Kyle J. McKay <mackyle@gmail.com>
Date
May 31, 2017, 10:26 UTC
Message-ID
<5139b7b6aa7735aefca283afef967d7@50ef27579de002095d3bc9134128513>
This subject line:
> Subject: [other] [PATCH] message

does not get along with the git mailinfo "-b" option. In fact, it triggers a fatal bug:

> fatal: `pos + len' is too far after the end of the buffer

While I did not do any exhaustive checking, I do happen to have a few builds of various versions of Git lying around and it fails at least as far back as v1.7.6. (The -b option was introduced in v1.6.6 I believe.)

At the very least this is now a "known breakage", so might as well have the tests for it.

If someone comes along and fixes it it's a simple matter to flip them to test_expect_success instead.

--Kyle
P.S. Oh yes, the real patch subject is below (love those >8).
-- 8< --
Subject: [PATCH] t5100: add some more mailinfo tests

Add some more simple mailinfo tests including a few that produce:

  fatal: `pos + len' is too far after the end of the buffer
Mark those as 'test_expect_failure'.
Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
---
Notes:
    checking known breakage:
    	subj="$(echo "Subject: [other] [PATCH] message" |
    		git mailinfo -b /dev/null /dev/null)" &&
    	test z"$subj" = z"Subject: [other] message"
    
    fatal: `pos + len' is too far after the end of the buffer
    not ok 46 - mailinfo -b trailing [PATCH] # TODO known breakage
    
    checking known breakage:
    	subj="$(echo "Subject: [PATCH] [other] [PATCH] message" |
    		git mailinfo -b /dev/null /dev/null)" &&
    	test z"$subj" = z"Subject: [other] message"
    
    fatal: `pos + len' is too far after the end of the buffer
    not ok 47 - mailinfo -b separated double [PATCH] # TODO known breakage
 t/t5100-mailinfo.sh | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh
index 7171f675..333395c8 100755
--- a/t/t5100-mailinfo.sh
+++ b/t/t5100-mailinfo.sh
@@ -170,5 +170,46 @@ test_expect_success 'mailinfo with mailinfo.scissors config' '
 	test_cmp "$DATA/info0014--scissors" info0014.sc
 '
 
+test_expect_success 'mailinfo no options' '
+	subj="$(echo "Subject: [PATCH] [other] [PATCH] message" |
+		git mailinfo /dev/null /dev/null)" &&
+	test z"$subj" = z"Subject: message"
+'
+
+test_expect_success 'mailinfo -k' '
+	subj="$(echo "Subject: [PATCH] [other] [PATCH] message" |
+		git mailinfo -k /dev/null /dev/null)" &&
+	test z"$subj" = z"Subject: [PATCH] [other] [PATCH] message"
+'
+
+test_expect_success 'mailinfo -b no [PATCH]' '
+	subj="$(echo "Subject: [other] message" |
+		git mailinfo -b /dev/null /dev/null)" &&
+	test z"$subj" = z"Subject: [other] message"
+'
+
+test_expect_success 'mailinfo -b leading [PATCH]' '
+	subj="$(echo "Subject: [PATCH] [other] message" |
+		git mailinfo -b /dev/null /dev/null)" &&
+	test z"$subj" = z"Subject: [other] message"
+'
+
+test_expect_success 'mailinfo -b double [PATCH]' '
+	subj="$(echo "Subject: [PATCH] [PATCH] message" |
+		git mailinfo -b /dev/null /dev/null)" &&
+	test z"$subj" = z"Subject: message"
+'
+
+test_expect_failure 'mailinfo -b trailing [PATCH]' '
+	subj="$(echo "Subject: [other] [PATCH] message" |
+		git mailinfo -b /dev/null /dev/null)" &&
+	test z"$subj" = z"Subject: [other] message"
+'
+
+test_expect_failure 'mailinfo -b separated double [PATCH]' '
+	subj="$(echo "Subject: [PATCH] [other] [PATCH] message" |
+		git mailinfo -b /dev/null /dev/null)" &&
+	test z"$subj" = z"Subject: [other] message"
+'
 
 test_done
---
Message 1 of 1 in “[BUG] test_expect_failure mailinfo -b fatals”
  1. [BUG] test_expect_failure mailinfo -b fatalsKyle J. McKay, May 31, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.