threads / patch / 46074

patch[BUG] test_expect_failure mailinfo -b fatals

Subject: [PATCH] [BUG] test_expect_failure mailinfo -b fatals

## tl;dr

One message between May 31, 2017 and May 31, 2017. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Kyle J. McKay· May 31, 2017, 10:26 UTC · lore
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(+)
Show changes to t/t5100-mailinfo.sh +41 −0
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
---

← back to recent threads