ksh: pty test random failure
Just putting this out there. I know it’s a race condition, you can run the test over and over and it’ll fail fail fail, then it’ll pass, then it’ll fail again. This isn’t new, it’s just got enough inertia that I opened an issue for it.
ksh@504d645f on m1Pro macOS 12.6.6
...
test pty begins at 2023-06-04+18:41:50
test pty passed at 2023-06-04+18:42:28 [ 58 tests 0 errors ]
test pty(C.UTF-8) begins at 2023-06-04+18:42:28
pty.sh[991]: FAIL: tab completion with space in string and -o noglob on: line 1001: expected "^:test-2: echo /private/var/folders/_h/w1zkv1tx5vq028wcyv5yhnnr0000gn/T/ksh93.shtests.85374.15052/pty.C.UTF-8/foo\\ bar \r\n$", got ":test-2: 000gn/T/ksh93.shtests.85374.15052/pty.C.UTF-8/foo\\ bar \r\n"
test pty(C.UTF-8) failed at 2023-06-04+18:43:06 with exit code 1 [ 58 tests 1 error ]
...
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 18
Commits related to this issue
- tests/pty.sh: Fix fail for long $TMPDIR or narrow terminal window For a sufficiently narrow Terminal.app window, the test on line 999 fails consistently. The expected tab-completed pathname is cut of... — committed to ksh93/ksh by McDutchie a year ago
- tests/pty.sh: Fix fail for long $TMPDIR or narrow terminal window For a sufficiently narrow Terminal.app window, the test on line 999 fails consistently. The expected tab-completed pathname is cut of... — committed to JohnoKing/ksh by McDutchie a year ago
I think I found the real cause of the problem.
My Terminal.app window is 132 columns wide. My iTerm window, the default 80.
When I narrow my Terminal.app window to 80 columns, the test fails equally.
In spite of pty being a pseudoterminal, ksh gets the window size from the real terminal. I don’t know how to fix that.
By default, the pty tests are run with TERM=dumb, on which multiline editing is not possible. On macOS, the $TMPDIR directory path is long, causing a temporary file path that won’t fit on a single line. This explains the regression test failure with the cut-off path.
The fix: run the test with multiline enabled. Please try this: