{"thread":{"id":"57527","subject":"[PATCH] test-lib: declare local variables as local","startedAt":"2022-03-09T21:48:49Z","lastAt":"2022-03-09T22:02:47Z","messageCount":2,"participants":["Michael J Gruber","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"450934","messageId":"81f43fbefde84ab7af9ee2ac760845b728a48ab5.1646861976.git.git@grubix.eu","threadId":"57527","inReplyTo":null,"subject":"[PATCH] test-lib: declare local variables as local","fromName":"Michael J Gruber","fromEmail":"git@grubix.eu","sentAt":"2022-03-09T21:41:43Z","receivedAt":"2022-03-09T21:48:49Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"131b94a10a (\"test-lib.sh: Use GLIBC_TUNABLES instead of MALLOC_CHECK_ on\nglibc >= 2.34\", 2022-03-04) introduced \"local\" variables without\ndeclaring them as such. This conflicts with their use in some tests (at\nleast when running them with dash), leading to test failures in:\n\nt0006-date.sh\nt2002-checkout-cache-u.sh\nt3430-rebase-merges.sh\nt4138-apply-ws-expansion.sh\nt4124-apply-ws-rule.sh\n\nDeclare those variables as local to let the tests pass again.\n\nSigned-off-by: Michael J Gruber <git@grubix.eu>\n---\n t/test-lib.sh | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex a3b711988c..e3c9822bf3 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -548,6 +548,8 @@ then\n \t}\n else\n \tsetup_malloc_check () {\n+\t\tlocal g\n+\t\tlocal t\n \t\tMALLOC_CHECK_=3\tMALLOC_PERTURB_=165\n \t\texport MALLOC_CHECK_ MALLOC_PERTURB_\n \t\tif _GLIBC_VERSION=$(getconf GNU_LIBC_VERSION 2>/dev/null) &&\n-- \n2.35.1.604.gdca35cc479\n\n"},{"id":"450939","messageId":"xmqqv8wmlr7l.fsf@gitster.g","threadId":"57527","inReplyTo":"81f43fbefde84ab7af9ee2ac760845b728a48ab5.1646861976.git.git@grubix.eu","subject":"Re: [PATCH] test-lib: declare local variables as local","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-03-09T22:02:38Z","receivedAt":"2022-03-09T22:02:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@grubix.eu> writes:\n\n> 131b94a10a (\"test-lib.sh: Use GLIBC_TUNABLES instead of MALLOC_CHECK_ on\n> glibc >= 2.34\", 2022-03-04) introduced \"local\" variables without\n> declaring them as such. This conflicts with their use in some tests (at\n> least when running them with dash), leading to test failures in:\n\nThanks.\n\n>\n> t0006-date.sh\n> t2002-checkout-cache-u.sh\n> t3430-rebase-merges.sh\n> t4138-apply-ws-expansion.sh\n> t4124-apply-ws-rule.sh\n>\n> Declare those variables as local to let the tests pass again.\n>\n> Signed-off-by: Michael J Gruber <git@grubix.eu>\n> ---\n>  t/test-lib.sh | 2 ++\n>  1 file changed, 2 insertions(+)\n>\n> diff --git a/t/test-lib.sh b/t/test-lib.sh\n> index a3b711988c..e3c9822bf3 100644\n> --- a/t/test-lib.sh\n> +++ b/t/test-lib.sh\n> @@ -548,6 +548,8 @@ then\n>  \t}\n>  else\n>  \tsetup_malloc_check () {\n> +\t\tlocal g\n> +\t\tlocal t\n>  \t\tMALLOC_CHECK_=3\tMALLOC_PERTURB_=165\n>  \t\texport MALLOC_CHECK_ MALLOC_PERTURB_\n>  \t\tif _GLIBC_VERSION=$(getconf GNU_LIBC_VERSION 2>/dev/null) &&\n"}]}