ksh: FreeBSD arm64: Various pty.sh test failures

As of 6b0489a3cb5b295db4b6e69cfc9d1682ca380d09 commit, the following pty failures now occur on my FreeBSD aarch64/arm64 box.

 $ uname -a
FreeBSD hades 13.1-RELEASE-p6 FreeBSD 13.1-RELEASE-p6 GENERIC arm64
$ arch/*/bin/ksh --version
  version         sh (AT&T Research) 93u+m/1.1.0-alpha+6b0489a3/MOD 2023-04-09
$ bin/shtests pty
#### Regression-testing /tmp/ksh/arch/freebsd13.arm64-64/bin/ksh ####
test pty begins at 2023-04-09+18:53:33
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 573: expected "^OK0\r\n$", got ":test-1: . ./test_t.sh\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 574: expected "^OK1\r\n$", got "OK0\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 575: expected "^OK2\r\n$", got "OK1\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 576: expected "^OK3\r\n$", got "OK2\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 577: expected "^OK4\r\n$", got "OK3\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 578: expected "^OK5\r\n$", got "OK4\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 579: expected "^OK6\r\n$", got "OK5\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 580: expected "^OK7\r\n$", got "OK6\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 581: expected "^OK8\r\n$", got "OK7\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 582: expected "^OK9\r\n$", got "OK8\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 583: expected "^OK10\r\n$", got "OK9\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 584: expected "^OK11\r\n$", got "OK10\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 585: expected "^:test-2:", got "OK11\r\n"
	pty.sh[588]: FAIL: race condition while launching external commands: line 598: expected "^/dev/null\r\n$", got ":test-1: printf '%s\\n' 1 2 3 4 5 | while read; do ls /dev/null; done\r\n"
	pty.sh[588]: FAIL: race condition while launching external commands: line 603: expected "^:test-2:", got "/dev/null\r\n"
	pty.sh[670]: FAIL: syntax error added to history file: line 679: expected ": syntax error: `do' unexpected\r\n$", got ":test-1: do something\r\n"
	pty.sh[670]: FAIL: syntax error added to history file: line 681: expected "^:test-2: fc -lN1\r\n$", got "/tmp/ksh/arch/freebsd13.arm64-64/bin/ksh: syntax error: `do' unexpected\r\n"
	pty.sh[670]: FAIL: syntax error added to history file: line 682: expected "\tdo something\r\n$", got ":test-2: fc -lN1\r\n"
	pty.sh[708]: FAIL: crash after switching from emacs to vi mode: line 720: expected "^:test-1: set -o vi\r\n$", got ":test-1: exec \"$SHELL\" -o emacs\r\n"
	pty.sh[758]: FAIL: Using b, B, w and W commands in vi mode: line 767: expected "^:test-2: echo asdf\r\n$", got ":test-1: set -o vi\r\n"
	pty.sh[758]: FAIL: Using b, B, w and W commands in vi mode: line 768: expected "^asdf\r\n$", got ":test-2: echo asdf^[bwBWa\r\n"
	pty.sh[782]: FAIL: syntax error in profile causes exit on startup: line 791: expected "^ok\r\n$", got ":test-1: echo ok\r\n"
	pty.sh[807]: FAIL: crash when entering comment into history file (vi mode): line 817: expected "\t#foo\r\n$", got "hist -lnN 1\r\n"
	pty.sh[807]: FAIL: crash when entering comment into history file (vi mode): line 818: expected "\thist -lnN 1\r\n$", got "\t#foo\r\n"
	pty.sh[821]: FAIL: tab completion while expanding ${.sh.*} variables: line 829: expected "^:test-1: test \$'foo\\'bar' \$\{.sh.level\}\r\n$", got ":test-1: test $'foo\\'bar' ${.sh.level\t\r\n"
	pty.sh[832]: FAIL: tab completion executes command substitutions: line 840: expected "^:test-1: \$\(echo true\)\r\n$", got ":test-1: $(echo true)\t\r\n"
	pty.sh[1138]: FAIL: full-word completion in vi mode: line 1145: expected "^:test-1: true fullcomplete/foi\r\n", got ":test-1: true fullcomplete/foi^[h\\a\r\n"
test pty failed at 2023-04-09+18:54:01 with exit code 27 [ 54 tests 27 errors ]
test pty(C.UTF-8) begins at 2023-04-09+18:54:01
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 573: expected "^OK0\r\n$", got ":test-1: . ./test_t.sh\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 574: expected "^OK1\r\n$", got "OK0\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 575: expected "^OK2\r\n$", got "OK1\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 576: expected "^OK3\r\n$", got "OK2\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 577: expected "^OK4\r\n$", got "OK3\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 578: expected "^OK5\r\n$", got "OK4\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 579: expected "^OK6\r\n$", got "OK5\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 580: expected "^OK7\r\n$", got "OK6\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 581: expected "^OK8\r\n$", got "OK7\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 582: expected "^OK9\r\n$", got "OK8\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 583: expected "^OK10\r\n$", got "OK9\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 584: expected "^OK11\r\n$", got "OK10\r\n"
	pty.sh[567]: FAIL: test -t 1 inside command substitution: line 585: expected "^:test-2:", got "OK11\r\n"
	pty.sh[588]: FAIL: race condition while launching external commands: line 598: expected "^/dev/null\r\n$", got ":test-1: printf '%s\\n' 1 2 3 4 5 | while read; do ls /dev/null; done\r\n"
	pty.sh[588]: FAIL: race condition while launching external commands: line 603: expected "^:test-2:", got "/dev/null\r\n"
	pty.sh[670]: FAIL: syntax error added to history file: line 679: expected ": syntax error: `do' unexpected\r\n$", got ":test-1: do something\r\n"
	pty.sh[670]: FAIL: syntax error added to history file: line 681: expected "^:test-2: fc -lN1\r\n$", got "/tmp/ksh/arch/freebsd13.arm64-64/bin/ksh: syntax error: `do' unexpected\r\n"
	pty.sh[670]: FAIL: syntax error added to history file: line 682: expected "\tdo something\r\n$", got ":test-2: fc -lN1\r\n"
	pty.sh[708]: FAIL: crash after switching from emacs to vi mode: line 720: expected "^:test-1: set -o vi\r\n$", got ":test-1: exec \"$SHELL\" -o emacs\r\n"
	pty.sh[748]: FAIL: autocomplete should not fill partial multibyte characters: line 755: expected "^:test-1: : XXX\r\n$", got ":test-1: : XX\t\r\n"
	pty.sh[758]: FAIL: Using b, B, w and W commands in vi mode: line 767: expected "^:test-2: echo asdf\r\n$", got ":test-1: set -o vi\r\n"
	pty.sh[758]: FAIL: Using b, B, w and W commands in vi mode: line 768: expected "^asdf\r\n$", got ":test-2: echo asdf^[bwBWa\r\n"
	pty.sh[782]: FAIL: syntax error in profile causes exit on startup: line 791: expected "^ok\r\n$", got ":test-1: echo ok\r\n"
	pty.sh[807]: FAIL: crash when entering comment into history file (vi mode): line 817: expected "\t#foo\r\n$", got "hist -lnN 1\r\n"
	pty.sh[807]: FAIL: crash when entering comment into history file (vi mode): line 818: expected "\thist -lnN 1\r\n$", got "\t#foo\r\n"
	pty.sh[821]: FAIL: tab completion while expanding ${.sh.*} variables: line 829: expected "^:test-1: test \$'foo\\'bar' \$\{.sh.level\}\r\n$", got ":test-1: test $'foo\\'bar' ${.sh.level\t\r\n"
	pty.sh[832]: FAIL: tab completion executes command substitutions: line 840: expected "^:test-1: \$\(echo true\)\r\n$", got ":test-1: $(echo true)\t\r\n"
	pty.sh[1138]: FAIL: full-word completion in vi mode: line 1145: expected "^:test-1: true fullcomplete/foi\r\n", got ":test-1: true fullcomplete/foi^[h\\a\r\n"
	pty.sh[1156]: FAIL: vi completion from wide produces corrupt characters: line 1163: expected "^:test-1: cd vitest/aあb/\r\n$", got ":test-1: cd vitest/aあ\t\r\n"
test pty(C.UTF-8) failed at 2023-04-09+18:54:28 with exit code 29 [ 54 tests 29 errors ]
Total errors: 56
CPU time       user:      system:
main:      0m00.048s    0m00.024s
tests:     0m02.490s    0m04.941s
$

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17

Commits related to this issue

Most upvoted comments

If your patch is going to detect that at runtime, then we should also remove the pth tput feature test and find the path to tput at runtime. The easiest way to do that is to run it with command -p, which uses the default PATH at runtime (thus ensuring the OS-provided tput will be run and not whatever command called tput might be found in the user’s PATH). Meaning, in get_tput() in edit.c, line 430 should be changed from

	sfprintf(sh.strbuf,".sh.value=${ " _pth_tput " %s 2>/dev/null;}",tp);

to

	sfprintf(sh.strbuf,".sh.value=${ \\command -p tput %s 2>/dev/null;}",tp);

(the initial \ bypasses alias expansion by quoting a part of the first command word; command itself already bypasses shell functions).

Of course then SH_MULTILINE should never be forced off in args.c.