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

Re: [PATCH v3 5/5] t6006: don't use iconv(1) without ICONV prereq

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 18, 2026, 17:46 UTC
Message-ID
<xmqqfr6y7xnn.fsf@gitster.g>
In-Reply-To
<20260218-b4-pks-ci-msvc-iconv-fixes-v3-5-08c1ff3ffc9a@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 5 quoted lines
> Two tests in t6006 depend on the iconv(1) prerequisite to reencode a
> commit message. This executable may not even exist though in case the
> prereq is not set, which will cause the tests to fail.
>
> Fix this by using UTF-8 instead when the prereq is not set.

The above makes perfect sense, but would the rest of the test involving this data need to be adjusted to expect utf-8 instead of $test_encoding when iconv is not available?

Show 15 quoted lines
> -iconv -f utf-8 -t $test_encoding > commit-msg <<EOF
> -Test printing of complex bodies
> +test_expect_success 'setup complex body' '
> +	message=$(cat <<-EOF
> +	Test printing of complex bodies
>  
> -This commit message is much longer than the others,
> -and it will be encoded in $test_encoding. We should therefore
> -include an ISO8859 character: ¡bueno!
> -EOF
> +	This commit message is much longer than the others,
> +	and it will be encoded in $test_encoding. We should therefore
> +	include an ISO8859 character: ¡bueno!
> +	EOF
> +	) &&
Creative use of "cat" only to strip leading.   Otherwise,
	message="Test printing of ...
	...
	include an ISO8859 character: ¡bueno!"
would have sufficed ;-).
Show 6 quoted lines
> +	if test_have_prereq ICONV
> +	then
> +		echo "$message" | iconv -f utf-8 -t $test_encoding >commit-msg
> +	else
> +		echo "$message" >commit-msg
> +	fi &&

So we have the message in the file encoded in either utf-8 or the target encoding.

> -test_expect_success 'setup complex body' '
>  	git config i18n.commitencoding $test_encoding &&

But we claim unconditionally $test_encoding is used in the commit object. This is OK because test_encoding is also set to UTF-8 in the IONV challenged environment. Cute.

Show 14 quoted lines
> @@ -448,7 +456,12 @@ test_expect_success 'setup expected messages (for test %b)' '
>  	commit $head2
>  	commit $head1
>  	EOF
> -	iconv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1
> +	if test_have_prereq ICONV
> +	then
> +		iconv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1
> +	else
> +		cp expected.utf-8 expected.ISO8859-1
> +	fi
>  '
>  
>  test_format complex-body %b <expected.ISO8859-1

And this is the same idea. It is confiusing that the data has nothing to do with Latin-1 when iconv is not in use, but things will even out. Nice.

Previous: Patrick SteinhardtNext: Christian Couder
Message 29 of 38 in “Fix tests with missing iconv(1) executable”
  1. 0/4 Fix tests with missing iconv(1) executablePatrick Steinhardt, Feb 9, 2026
  2. 1/4 t4xxx: don't use iconv(1) without ICONV prereqPatrick Steinhardt, Feb 9, 2026
  3. Junio C HamanoFeb 9, 2026
  4. Torsten BögershausenFeb 10, 2026
  5. Patrick SteinhardtFeb 10, 2026
  6. Junio C HamanoFeb 10, 2026
  7. 2/4 t4205: improve handling of ICONV prerequisitePatrick Steinhardt, Feb 9, 2026
  8. 3/4 t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"Patrick Steinhardt, Feb 9, 2026
  9. 4/4 t6006: don't use iconv(1) without ICONV prereqPatrick Steinhardt, Feb 9, 2026
  10. Christian CouderFeb 16, 2026
  11. Patrick SteinhardtFeb 17, 2026
  12. Christian CouderFeb 16, 2026
  13. Patrick SteinhardtFeb 17, 2026
  14. 0/4 Fix tests with missing iconv(1) executablePatrick Steinhardt, Feb 17, 2026
  15. 1/4 t4xxx: don't use iconv(1) without ICONV prereqPatrick Steinhardt, Feb 17, 2026
  16. Christian CouderFeb 17, 2026
  17. Patrick SteinhardtFeb 17, 2026
  18. 2/4 t4205: improve handling of ICONV prerequisitePatrick Steinhardt, Feb 17, 2026
  19. 3/4 t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"Patrick Steinhardt, Feb 17, 2026
  20. 4/4 t6006: don't use iconv(1) without ICONV prereqPatrick Steinhardt, Feb 17, 2026
  21. 0/5 Fix tests with missing iconv(1) executablePatrick Steinhardt, Feb 18, 2026
  22. 1/5 t: don't set ICONV prereq when iconv(1) is missingPatrick Steinhardt, Feb 18, 2026
  23. 2/5 t40xx: don't use iconv(1) without ICONV prereqPatrick Steinhardt, Feb 18, 2026
  24. 3/5 t4205: improve handling of ICONV prerequisitePatrick Steinhardt, Feb 18, 2026
  25. 4/5 t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"Patrick Steinhardt, Feb 18, 2026
  26. Eric SunshineFeb 19, 2026
  27. Patrick SteinhardtFeb 20, 2026
  28. 5/5 t6006: don't use iconv(1) without ICONV prereqPatrick Steinhardt, Feb 18, 2026
  29. Junio C HamanoFeb 18, 2026
  30. Christian CouderFeb 18, 2026
  31. Patrick SteinhardtFeb 18, 2026
  32. 0/5 Fix tests with missing iconv(1) executablePatrick Steinhardt, Feb 20, 2026
  33. 1/5 t: don't set ICONV prereq when iconv(1) is missingPatrick Steinhardt, Feb 20, 2026
  34. 2/5 t40xx: don't use iconv(1) without ICONV prereqPatrick Steinhardt, Feb 20, 2026
  35. 3/5 t4205: improve handling of ICONV prerequisitePatrick Steinhardt, Feb 20, 2026
  36. 4/5 t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"Patrick Steinhardt, Feb 20, 2026
  37. 5/5 t6006: don't use iconv(1) without ICONV prereqPatrick Steinhardt, Feb 20, 2026
  38. Junio C HamanoFeb 20, 2026

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.