From: neil Date: Fri, 7 Aug 2026 19:47:24 +0000 (+0000) Subject: patch 9.2.0921: test: terminal tests fail on FreeBSD X-Git-Tag: v9.2.0921^0 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b77d4da3da5c91b2e7ae4bdff606f31a80fb7b7d;p=thirdparty%2Fvim.git patch 9.2.0921: test: terminal tests fail on FreeBSD Problem: terminal test fail on FreeBSD: the shell enables its line editor when interactive on a terminal, which echoes the typed command a second time and shifts the output down by one line, so getline(2) returns "exit" instead of the value. Solution: Point $ENV to a startup file that turns the line editor off in Run_shell_in_terminal(). POSIX shells read it at startup and it produces no output of its own; shells that do not use $ENV ignore it (neil). closes: #20972 Signed-off-by: neil Signed-off-by: Christian Brabandt --- diff --git a/src/testdir/util/term_util.vim b/src/testdir/util/term_util.vim index afb44c8dbb..d362976847 100644 --- a/src/testdir/util/term_util.vim +++ b/src/testdir/util/term_util.vim @@ -181,11 +181,29 @@ endfunc " Open a terminal with a shell, assign the job to g:job and return the buffer " number. +" Some shells turn on a line editor when they are interactive on a +" terminal; FreeBSD /bin/sh does. The editor redraws the line the +" terminal has already echoed, so a command can land in the buffer +" twice and shift everything below it. POSIX shells read $ENV at +" startup and it produces no output of its own; shells that do not +" use $ENV ignore the variable. +let s:shell_env_file = '' + +func s:ShellStartupFile() + if s:shell_env_file == '' || !filereadable(s:shell_env_file) + let s:shell_env_file = tempname() + call writefile(['set +o emacs 2>/dev/null', 'set +o vi 2>/dev/null'], s:shell_env_file) + endif + return s:shell_env_file +endfunc + func Run_shell_in_terminal(options) if has('win32') let buf = term_start([&shell, '/D', '/k'], a:options) else - let buf = term_start(&shell, a:options) + let options = copy(a:options) + let options.env = extend({'ENV': s:ShellStartupFile()}, get(a:options, 'env', {})) + let buf = term_start(&shell, options) endif let g:test_is_flaky = 1 diff --git a/src/version.c b/src/version.c index 674e2fbad5..0986404464 100644 --- a/src/version.c +++ b/src/version.c @@ -763,6 +763,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 921, /**/ 920, /**/