[packages/git-core] fix tests compatibility issues with mksh

atler atler at pld-linux.org
Sun Jan 12 02:07:51 CET 2025


commit 677b02c0ba5b91bd899cde32bd42dc57cdced3aa
Author: Jan Palus <atler at pld-linux.org>
Date:   Sun Jan 12 00:11:59 2025 +0100

    fix tests compatibility issues with mksh

 git-core.spec           |  2 ++
 tests-mksh-compat.patch | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)
---
diff --git a/git-core.spec b/git-core.spec
index b63f91d..0a27985 100644
--- a/git-core.spec
+++ b/git-core.spec
@@ -30,6 +30,7 @@ Patch0:		%{name}-key-bindings.patch
 Patch1:		%{name}-sysconfdir.patch
 Patch2:		cherry-picked-commitlog.patch
 Patch3:		no-meson-test-check.patch
+Patch4:		tests-mksh-compat.patch
 URL:		http://git-scm.com/
 BuildRequires:	autoconf >= 2.59
 BuildRequires:	automake
@@ -453,6 +454,7 @@ Dopełnianie parametrów komendy git dla powłoki zsh.
 %patch -P1 -p1
 %patch -P2 -p1
 %patch -P3 -p1
+%patch -P4 -p1
 
 # we build things in contrib but want to have it clean for doc purporses, too
 cp -a contrib contrib-doc
diff --git a/tests-mksh-compat.patch b/tests-mksh-compat.patch
new file mode 100644
index 0000000..12a398b
--- /dev/null
+++ b/tests-mksh-compat.patch
@@ -0,0 +1,40 @@
+From 17e4160cac5807e55057d88c4d53850c2a660ec6 Mon Sep 17 00:00:00 2001
+From: Jan Palus <jpalus at fastmail.com>
+Date: Sat, 11 Jan 2025 23:11:12 +0100
+Subject: [PATCH] t8002-blame: simplify padding generation in blank boundary
+ tests
+
+Fixes compatibility with mksh as well:
+$ mksh -c 'printf "%0.s" ""'
+printf: %0.s: invalid conversion specification
+
+Fixes: e7fb2ca945 ("builtin/blame: fix out-of-bounds write with blank boundary commits")
+---
+ t/t8002-blame.sh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/t/t8002-blame.sh b/t/t8002-blame.sh
+index 1ad039e123..e98993276a 100755
+--- a/t/t8002-blame.sh
++++ b/t/t8002-blame.sh
+@@ -138,7 +138,7 @@ test_expect_success 'blame --abbrev -b truncates the blank boundary' '
+ 	# Note that `--abbrev=` always gets incremented by 1, which is why we
+ 	# expect 11 leading spaces and not 10.
+ 	cat >expect <<-EOF &&
+-	$(printf "%0.s " $(test_seq 11)) (<author at example.com> 2005-04-07 15:45:13 -0700 1) abbrev
++	$(printf "%11s" "") (<author at example.com> 2005-04-07 15:45:13 -0700 1) abbrev
+ 	EOF
+ 	git blame -b --abbrev=10 ^HEAD -- abbrev.t >actual &&
+ 	test_cmp expect actual
+@@ -146,7 +146,7 @@ test_expect_success 'blame --abbrev -b truncates the blank boundary' '
+ 
+ test_expect_success 'blame with excessive --abbrev and -b culls to hash length' '
+ 	cat >expect <<-EOF &&
+-	$(printf "%0.s " $(test_seq $hexsz)) (<author at example.com> 2005-04-07 15:45:13 -0700 1) abbrev
++	$(printf "%${hexsz}s" "") (<author at example.com> 2005-04-07 15:45:13 -0700 1) abbrev
+ 	EOF
+ 	git blame -b --abbrev=9000 ^HEAD -- abbrev.t >actual &&
+ 	test_cmp expect actual
+-- 
+2.48.0
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/git-core.git/commitdiff/677b02c0ba5b91bd899cde32bd42dc57cdced3aa



More information about the pld-cvs-commit mailing list