{"thread":{"id":"64542","subject":"[PATCH 0/2] zsh testsuite fixes","startedAt":"2025-11-28T01:21:14Z","lastAt":"2025-11-28T01:21:14Z","messageCount":3,"participants":["brian m. carlson"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"531388","messageId":"20251128012107.101431-1-sandals@crustytoothpaste.net","threadId":"64542","inReplyTo":null,"subject":"[PATCH 0/2] zsh testsuite fixes","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2025-11-28T01:21:04Z","receivedAt":"2025-11-28T01:21:14Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"This series contains two small patches to make our testsuite pass under\nzsh's sh mode with 5.9.  This is the mode that is in use when zsh is\ninvoked as `sh` and differs from zsh's default behavior.\n\nNote that no attempt has been made to make the testsuite work under\nzsh's default or ksh modes, since it is known that many tests will\nfail in this case (in part, because outside of sh mode, zsh runs the\nfinal process in a pipeline in the main shell instead of a subshell).\n\nThe first patch fixes a compatibility issue in which we've accidentally\nrequested behavior from POSIX 1003.1-2024, which is too new to be\nportably supported.  It just so happens that most shells happen to\nsupport it anyway, but zsh does not at the moment.\n\nThe second patch fixes a more mysterious issue with the testsuite\nhanging.  It's unclear why it does so, but it almost certainly has to do\nwith the internals of the testsuite since creating a simple testcase\ndoes not reproduce the problem.  However, the patch is simple and easy\n(simply change to a subshell), so we do so.\n\nWith these two patches, the testsuite passes in zsh's sh mode.  This\nshould offer users whose `/bin/sh` is AT&T ksh93 (which does not support\n`local` and therefore does not work as our shell) an additional choice\nof shells to use for portability.\n\nbrian m. carlson (2):\n  t0614: use numerical comparison with test_line_count\n  t5564: fix test hang under zsh's sh mode\n\n t/t0614-reftable-fsck.sh | 2 +-\n t/t5564-http-proxy.sh    | 4 ++--\n 2 files changed, 3 insertions(+), 3 deletions(-)\n\n"},{"id":"531389","messageId":"20251128012107.101431-2-sandals@crustytoothpaste.net","threadId":"64542","inReplyTo":"20251128012107.101431-1-sandals@crustytoothpaste.net","subject":"[PATCH 1/2] t0614: use numerical comparison with test_line_count","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2025-11-28T01:21:05Z","receivedAt":"2025-11-28T01:21:14Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"In this comparison, we want to know whether the number of lines is\ngreater than 1.  Our test_line_count function passes the first argument\nas the comparison operator to test, so what we want is a numerical\ncomparison, not a string comparison.  While this does not produce a\nfunctional problem now, it could very well if we expected two or more\nitems, in which case the value \"10\" would not match when it should.\n\nFurthermore, the \"<\" and \">\" comparisons are new in POSIX 1003.1-2024\nand we don't want to require such a new version of POSIX since many\npopular and supported operating systems were released before that\nversion of POSIX was released.\n\nFinally, zsh's builtin test operator does not like the greater-than sign\nin \"test\", since it is only supported in the double-bracket extension.\nThis has been reported and will be addressed in a future version, but\nsince our code is also technically incorrect, as well as not very\ncompatible, let's fix it by using a numeric comparison.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t0614-reftable-fsck.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t0614-reftable-fsck.sh b/t/t0614-reftable-fsck.sh\nindex 85cc47d67e..677eb9143c 100755\n--- a/t/t0614-reftable-fsck.sh\n+++ b/t/t0614-reftable-fsck.sh\n@@ -20,7 +20,7 @@ test_expect_success \"no errors reported on a well formed repository\" '\n \t\tdone &&\n \n \t\t# The repository should end up with multiple tables.\n-\t\ttest_line_count \">\" 1 .git/reftable/tables.list &&\n+\t\ttest_line_count -gt 1 .git/reftable/tables.list &&\n \n \t\tgit refs verify 2>err &&\n \t\ttest_must_be_empty err\n"},{"id":"531390","messageId":"20251128012107.101431-3-sandals@crustytoothpaste.net","threadId":"64542","inReplyTo":"20251128012107.101431-1-sandals@crustytoothpaste.net","subject":"[PATCH 2/2] t5564: fix test hang under zsh's sh mode","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2025-11-28T01:21:06Z","receivedAt":"2025-11-28T01:21:14Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"This test starts a SOCKS server in Perl in the background and then kills\nit after the tests are done.  However, when using zsh (in sh mode) in\nthe tests, the start_socks function hangs until the background process\nis killed.\n\nNote that this does not reproduce in a simple shell script, so there is\nlikely some interaction between job handling, our heavy use of eval in\nthe test framework, and possibly other complexities of our test\nframework.  What is clear, however, is that switching from a compound\nstatement to a subshell fixes the problem entirely and the test passes\nwith no problem, so do that.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t5564-http-proxy.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t5564-http-proxy.sh b/t/t5564-http-proxy.sh\nindex c3903faf2d..3bcbdef409 100755\n--- a/t/t5564-http-proxy.sh\n+++ b/t/t5564-http-proxy.sh\n@@ -40,10 +40,10 @@ test_expect_success 'clone can prompt for proxy password' '\n \n start_socks() {\n \tmkfifo socks_output &&\n-\t{\n+\t(\n \t\t\"$PERL_PATH\" \"$TEST_DIRECTORY/socks4-proxy.pl\" \"$1\" >socks_output &\n \t\techo $! > \"$TRASH_DIRECTORY/socks.pid\"\n-\t} &&\n+\t) &&\n \tread line <socks_output &&\n \ttest \"$line\" = ready\n }\n"}]}