ksh93 / ksh

ksh 93u+m: KornShell lives! | Latest release: https://github.com/ksh93/ksh/releases
Eclipse Public License 2.0
187 stars 31 forks source link

Function autoload apparently broken on DragonFly BSD #432

Open McDutchie opened 2 years ago

McDutchie commented 2 years ago

This is a regression test run on DragonFly BSD 6.1 x86_64, with some thousands of repetitive lines removed where marked:

package: test start at Sun Jan 16 21:51:28 CET 2022 in /usr/local/src/ksh/arch/dragonfly.i386-64
#### Regression-testing /usr/local/src/ksh/arch/dragonfly.i386-64/bin/ksh ####
test alias begins at 2022-01-16+21:51:28
test alias passed at 2022-01-16+21:51:28 [ 45 tests 0 errors ]
test append begins at 2022-01-16+21:51:28
test append passed at 2022-01-16+21:51:28 [ 17 tests 0 errors ]
test arith begins at 2022-01-16+21:51:28
test arith passed at 2022-01-16+21:51:28 [ 247 tests 0 errors ]
test arrays begins at 2022-01-16+21:51:28
test arrays passed at 2022-01-16+21:51:29 [ 157 tests 0 errors ]
test arrays2 begins at 2022-01-16+21:51:29
test arrays2 passed at 2022-01-16+21:51:29 [ 56 tests 0 errors ]
test attributes begins at 2022-01-16+21:51:29
test attributes passed at 2022-01-16+21:51:29 [ 149 tests 0 errors ]
test basic begins at 2022-01-16+21:51:29
test basic passed at 2022-01-16+21:51:41 [ 136 tests 0 errors ]
test bracket begins at 2022-01-16+21:51:41
test bracket passed at 2022-01-16+21:51:42 [ 159 tests 0 errors ]
test builtins begins at 2022-01-16+21:51:42
test builtins passed at 2022-01-16+21:51:51 [ 281 tests 0 errors ]
test case begins at 2022-01-16+21:51:51
test case passed at 2022-01-16+21:51:51 [ 22 tests 0 errors ]
test comvar begins at 2022-01-16+21:51:51
test comvar passed at 2022-01-16+21:51:51 [ 101 tests 0 errors ]
test comvario begins at 2022-01-16+21:51:51
test comvario passed at 2022-01-16+21:51:53 [ 72 tests 0 errors ]
test coprocess begins at 2022-01-16+21:51:53
test coprocess passed at 2022-01-16+21:51:56 [ 34 tests 0 errors ]
test cubetype begins at 2022-01-16+21:51:56
test cubetype passed at 2022-01-16+21:51:56 [ 68 tests 0 errors ]
test enum begins at 2022-01-16+21:51:56
test enum passed at 2022-01-16+21:51:56 [ 40 tests 0 errors ]
test exit begins at 2022-01-16+21:51:56
test exit passed at 2022-01-16+21:51:56 [ 33 tests 0 errors ]
test expand begins at 2022-01-16+21:51:56
test expand passed at 2022-01-16+21:51:56 [ 7 tests 0 errors ]
test functions begins at 2022-01-16+21:51:56
/usr/local/src/ksh/src/cmd/ksh93/tests/functions.sh: line 236: function: not found
    functions.sh[237]: FAIL: autoload not working
    functions.sh[438]: FAIL: function file without function definition processes wrong error -- expected '126', got '0'
test functions failed at 2022-01-16+21:51:58 with exit code 2 [ 119 tests 2 errors ]
test glob begins at 2022-01-16+21:51:58
test glob passed at 2022-01-16+21:51:58 [ 174 tests 0 errors ]
test grep begins at 2022-01-16+21:51:58
test grep passed at 2022-01-16+21:51:58 [ 1 test 0 errors ]
test heredoc begins at 2022-01-16+21:51:58
test heredoc passed at 2022-01-16+21:51:59 [ 42 tests 0 errors ]
test io begins at 2022-01-16+21:51:59
    io.sh[99]: FAIL: /dev/fd/N failed semantics instead of open|dup -- expected '1234|4', got '43'
test io failed at 2022-01-16+21:52:02 with exit code 1 [ 150 tests 1 error ]
test jobs begins at 2022-01-16+21:52:02
test jobs passed at 2022-01-16+21:52:02 [ 25 tests 0 errors ]
test leaks begins at 2022-01-16+21:52:02
    leaks.sh[171]: warning: skipping test for known leak "defining associative array in subshell"; export DEBUG=y to test and help us fix it at: https://github.com/ksh93/ksh/issues/94
/usr/local/src/ksh/src/cmd/ksh93/tests/leaks.sh: line 328: function: not found
[... 2303 REPETITIONS REMOVED ...]
/usr/local/src/ksh/src/cmd/ksh93/tests/leaks.sh: line 328: function: not found
    leaks.sh[356]: warning: skipping test for known leak "set PATH attribute in main shell"; export DEBUG=y to test and help us fix it at: https://github.com/ksh93/ksh/issues/405
    leaks.sh[364]: warning: skipping test for known leak "unset PATH in main shell"; export DEBUG=y to test and help us fix it at: https://github.com/ksh93/ksh/issues/405
    leaks.sh[377]: warning: skipping test for known leak "set PATH value in subshell"; export DEBUG=y to test and help us fix it at: https://github.com/ksh93/ksh/issues/405
    leaks.sh[382]: warning: skipping test for known leak "run command with preceding PATH assignment in subshell"; export DEBUG=y to test and help us fix it at: https://github.com/ksh93/ksh/issues/405
    leaks.sh[387]: warning: skipping test for known leak "set PATH attribute in subshell"; export DEBUG=y to test and help us fix it at: https://github.com/ksh93/ksh/issues/405
    leaks.sh[392]: warning: skipping test for known leak "unset PATH in subshell"; export DEBUG=y to test and help us fix it at: https://github.com/ksh93/ksh/issues/405
    leaks.sh[416]: warning: skipping test for known leak "variable with discipline function in subshell"; export DEBUG=y to test and help us fix it at: https://github.com/ksh93/ksh/issues/404
    leaks.sh[422]: warning: skipping test for known leak "showing --man info"; export DEBUG=y to test and help us fix it at: https://github.com/ksh93/ksh/issues/407
test leaks passed at 2022-01-16+21:52:07 [ 35 tests 0 errors ]
test locale begins at 2022-01-16+21:52:07
test locale passed at 2022-01-16+21:52:07 [ 37 tests 0 errors ]
test math begins at 2022-01-16+21:52:07
test math passed at 2022-01-16+21:52:10 [ 17 tests 0 errors ]
test nameref begins at 2022-01-16+21:52:10
test nameref passed at 2022-01-16+21:52:10 [ 95 tests 0 errors ]
test namespace begins at 2022-01-16+21:52:10
test namespace passed at 2022-01-16+21:52:10 [ 17 tests 0 errors ]
test options begins at 2022-01-16+21:52:10
test options passed at 2022-01-16+21:52:14 [ 171 tests 0 errors ]
test path begins at 2022-01-16+21:52:14
/usr/local/src/ksh/src/cmd/ksh93/tests/path.sh: line 392: function: not found
[... 23 REPETITIONS REMOVED ...]
/usr/local/src/ksh/src/cmd/ksh93/tests/path.sh: line 392: function: not found
/usr/local/src/ksh/src/cmd/ksh93/tests/path.sh: line 543: /usr/local/src/ksh/arch/dragonfly.i386-64/bin/ksh: cannot execute [Bad address]
    path.sh[563]: FAIL: 'command -x' test yielded exit status 126
    path.sh[571]: FAIL: 'command -x' did not correctly divide arguments (expected 82557 args of total size 811974, got 0 args of total size 0; divided in 0 chunks)
test path failed at 2022-01-16+21:52:14 with exit code 2 [ 140 tests 2 errors ]
test pointtype begins at 2022-01-16+21:52:14
test pointtype passed at 2022-01-16+21:52:15 [ 34 tests 0 errors ]
test pty begins at 2022-01-16+21:52:15
    pty.sh[38]: warning: pty not confirmed to work correctly on this system -- tests skipped
test pty passed at 2022-01-16+21:52:15 [ 43 tests 0 errors ]
test quoting begins at 2022-01-16+21:52:15
test quoting passed at 2022-01-16+21:52:16 [ 94 tests 0 errors ]
test quoting2 begins at 2022-01-16+21:52:16
test quoting2 passed at 2022-01-16+21:52:16 [ 67 tests 0 errors ]
test readcsv begins at 2022-01-16+21:52:16
test readcsv passed at 2022-01-16+21:52:16 [ 4 tests 0 errors ]
test readonly begins at 2022-01-16+21:52:16
test readonly passed at 2022-01-16+21:52:16 [ 8 tests 0 errors ]
test recttype begins at 2022-01-16+21:52:16
test recttype passed at 2022-01-16+21:52:16 [ 8 tests 0 errors ]
test restricted begins at 2022-01-16+21:52:16
test restricted passed at 2022-01-16+21:52:16 [ 21 tests 0 errors ]
test return begins at 2022-01-16+21:52:16
test return passed at 2022-01-16+21:52:16 [ 47 tests 0 errors ]
test select begins at 2022-01-16+21:52:16
test select passed at 2022-01-16+21:52:16 [ 4 tests 0 errors ]
test sigchld begins at 2022-01-16+21:52:16
test sigchld passed at 2022-01-16+21:52:27 [ 14 tests 0 errors ]
test signal begins at 2022-01-16+21:52:27
test signal passed at 2022-01-16+21:52:36 [ 51 tests 0 errors ]
test statics begins at 2022-01-16+21:52:36
test statics passed at 2022-01-16+21:52:36 [ 7 tests 0 errors ]
test subshell begins at 2022-01-16+21:52:36
test subshell passed at 2022-01-16+21:52:49 [ 134 tests 0 errors ]
test substring begins at 2022-01-16+21:52:49
test substring passed at 2022-01-16+21:52:50 [ 212 tests 0 errors ]
test tilde begins at 2022-01-16+21:52:50
test tilde passed at 2022-01-16+21:52:50 [ 24 tests 0 errors ]
test timetype begins at 2022-01-16+21:52:50
test timetype passed at 2022-01-16+21:52:50 [ 18 tests 0 errors ]
test treemove begins at 2022-01-16+21:52:50
test treemove passed at 2022-01-16+21:52:50 [ 9 tests 0 errors ]
test types begins at 2022-01-16+21:52:50
test types passed at 2022-01-16+21:52:50 [ 89 tests 0 errors ]
test variables begins at 2022-01-16+21:52:50
    variables.sh[1291]: FAIL: Regression in $LINENO and/or error messages. Diff follows:
    | --- /dev/fd/4 2022-01-16 22:21:58.017635000 +0100
    | +++ /dev/fd/5 2022-01-16 22:21:58.017635000 +0100
    | @@ -1,10 +1,5 @@
    |  begin: main script $LINENO == 1
    | -In definition file, outside function: $LINENO on line 8 is 8
    | -./lineno_autoload[7]: main_script_fn: line 9: ${bad\subst\in\def\file\on\line\9}: bad substitution
    | -Hi, I'm a function! On line 3, my $LINENO is 3
    | -./lineno_autoload[7]: main_script_fn[4]: lineno_autoload_fn: line 4: ${bad\subst\in\function\on\line\4}: bad substitution
    | -./lineno_autoload[7]: main_script_fn[4]: lineno_autoload_fn[5]: eval: syntax error at line 1: `(' unexpected
    | -Hi, I'm still a function! On line 6, my $LINENO is 6
    | +./lineno_autoload[7]: main_script_fn[4]: lineno_autoload_fn: cannot execute [Permission denied]
    |  ./lineno_autoload[7]: main_script_fn: line 5: ${bad\subst\in\main_script_fn\on\line\5}: bad substitution
    |  ./lineno_autoload[8]: eval: syntax error at line 1: `(' unexpected
    |  ./lineno_autoload: line 9: ${bad\subst\in\main\script\on\line\9}: bad substitution
test variables failed at 2022-01-16+21:52:54 with exit code 1 [ 180 tests 1 error ]
test vartree1 begins at 2022-01-16+21:52:54
test vartree1 passed at 2022-01-16+21:52:54 [ 9 tests 0 errors ]
test vartree2 begins at 2022-01-16+21:52:54
test vartree2 passed at 2022-01-16+21:52:54 [ 21 tests 0 errors ]
Total errors: 6
CPU time       user:      system:
main:      0m00.009s    0m00.008s
tests:     0m11.214s    0m19.743s
package: test failed at Sun Jan 16 21:52:54 CET 2022 in /usr/local/src/ksh/arch/dragonfly.i386-64
krader1961 commented 10 months ago

I have to ask: Why are you, @McDutchie, still working on trying to make (not keep) Ksh relevant? I made a mistake trying to do so several years ago. I did so primarily out of nostalgia because Ksh was the first Unix shell I liked. Primarily because the Bourne and Csh shells I used before Ksh in the 1980's were awful in comparison.

The Ksh source code was borderline beyond repair, or relevance, when I, along with ~siteshwar from RedHat, attempted to modernize it several years ago. No one should be using Ksh today. While I dislike the style of the Bash source code it, and the Zsh source code, are not nearly as awful and buggy as the Ksh source code. The Ksh source code is the worst I've ever seen in four decades of programming. I was honestly surprised how awful it was when I looked at it for the first time since I had used Ksh as my daily shell for almost a decade. I thought, naively, I could fix most of its problems using modern software development tools like OCLint to find and fix problems with the code. But then I noticed there was more than one function longer than 1000 lines containing multiple goto's. Not to mention the obvious bugs such as returning the address of a function (stack) local variable to the caller. The Ksh source code is irredeemable.

McDutchie commented 10 months ago

Thank you for your opinion, which is duly noted.