-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Completion crashes when using the vi line editor. #1429
Comments
PS—No such crash with |
The command completion behavior is extremely user unfriendly. This works in ksh93v- but on my system produces 2805 lines of output before displaying another prompt with the cursor incorrectly positioned. You have to type the number of one of the displayed commands then press [tab] to place it, incorrectly, on the current line and allow typing more arguments. If you just press [enter] the shell exits. The problem is that P.S., I had forgotten how painful, and slow, building the ksh93v- version is (12 minutes on my system). This makes debugging issues where comparison is between the current and ksh93v- code extremely slow and painful. |
This failure mode is unlikely to occur in the ksh93v- release due to its use of AST Vmalloc. Which we know masks a large number of memory management bugs because we've already fixed a huge number that were exposed when we switched from AST Vmalloc to the system malloc. The failure is due to a really bad anti-pattern we've seen elsewhere in the code. Specifically, temporarily modifying the byte immediately before or after a dynamically allocated buffer (in this case before). The SIGBUS on macOS is because the buffer is page aligned and the previous VM region is a 4KiB page containing malloc metadata that can be read but not modified. That's why the Here is what we learn when running with ASAN enabled:
|
Also, I built an instrumented version of ksh93v- to report critical values like |
As noted on the pull request thread (#1437), while @krader1961's change seems to fix the original issue I've observed a related
In
In the
Would you like me to open a separate issue? |
Normally, yes. But it just so happens the new failure is so closely related to the original failure we might as well track both in this issue. I obviously neglected to check if there was any other place in |
Gah! Looking at the code block containing the new failure made me upchuck my lunch. I sincerely hope the person who wrote this code has learned not to do things like this or is no longer writing code. |
Please explain to me the purpose of this statement: ast/src/cmd/ksh93/edit/completion.c Line 267 in ffbfaf6
Specifically, why it is predicating adding an additional one on the current edit mode being vi. And why is this function seemingly using space in the |
The completion code is badly broken. Using ksh93v-, and attempting to complete commands containing (or beginning with?) P.S., Interestingly, ksh93u+ handles |
Description of problem:
ksh
crashes on tab completion when using the vi line editor.Ksh version:
Current HEAD, 8e4c8f09, i.e.
How reproducible:
Consistently reproducible on my macOS and OpenBSD systems.
Steps to reproduce:
set -o vi
)Actual results:
Abort trap with a core dump on OpenBSD; bus error on macOS.
Additional info:
This assignment seems to be the immediate cause:
(
lldb
on macOS 10.14.6)The text was updated successfully, but these errors were encountered: