-
-
Notifications
You must be signed in to change notification settings - Fork 683
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
Running "browse tabnew" command in TUI MacVim crashes Vim #1107
Comments
Just reproduced this. Thanks for the report. |
The following commands also crash Vim: "browse enew", "browse split", Most probably the fix is the same for all of these commands. The backtrace for one of the crashes is:
I am not able to build MacVim with debug symbols enabled and load it in lldb. I am able to build the regular Vim with debug symbols enabled on MacOS, Linux |
It can reproduce in Linux and other OS by defining |
Conditions that causes the problem:
|
Regarding building for debugging, @yegappan , see https://github.com/macvim-dev/macvim/wiki/Building. In particular, this should work:
|
Just looking at older builds, seems like most of them suffer the same issue. I think this is a pretty old bug. At least 1 year old. |
This issue is caused by fname_case() trying to copy a string to If I use vim_strsave() to create a copy of the "." string, then the The patch is below:
|
An updated patch that fixes this problem without a memory leak is:
|
Maybe it can use stack, I think because: --- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -2465,6 +2465,7 @@ do_ecmd(
bufref_T old_curbuf;
char_u *free_fname = NULL;
#ifdef FEAT_BROWSE
+ char_u dot_path[] = ".";
char_u *browse_file = NULL;
#endif
int retval = FAIL;
@@ -2511,7 +2512,7 @@ do_ecmd(
// No browsing supported but we do have the file explorer:
// Edit the directory.
if (ffname == NULL || !mch_isdir(ffname))
- ffname = (char_u *)".";
+ ffname = dot_path;
}
else
{
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -6084,6 +6084,7 @@ ex_splitview(exarg_T *eap)
char_u *fname = NULL;
#endif
#ifdef FEAT_BROWSE
+ char_u dot_path[] = ".";
int browse_flag = cmdmod.browse;
#endif
int use_tab = eap->cmdidx == CMD_tabedit
@@ -6136,7 +6137,7 @@ ex_splitview(exarg_T *eap)
// No browsing supported but we do have the file explorer:
// Edit the directory.
if (*eap->arg == NUL || !mch_isdir(eap->arg))
- eap->arg = (char_u *)".";
+ eap->arg = dot_path;
}
else
{ |
I like @ichizok's version, and it also removes the insidious const cast here (which cast Can we move the discussion to https://github.com/vim/vim though? |
Also, seems like there is a coverage gap here in that no test is exercising |
I agree. We can go with the changes from @ichizok. Can you create a PR in the upstream Vim repository? It will be difficult to create a test for this as this needs a GUI Vim running in a Terminal on MS-Windows |
This issue has now been fixed in the upstream by 8.2.1842. |
Thanks. Will be merged from upstream. |
Updated to Vim 8.2.2127. *Note*: This release doesn't natively support Apple Silicon / M1 yet, but does work under Rosetta. See below. Features ==================== Big Sur / macOS 11 -------------------- - MacVim now has an updated app icon (#1054), and preference pane / toolbars have been updated to match Big Sur's interface guidelines. (#1128) - Fixed Touch Bar warnings when launching MacVim from the terminal. #1114 - SF Symbol characters will show up properly as double-width as most of these icons would take up more than one column. Note that these characters are specific to macOS and would not work in other platforms. #1129 Renderer / scrolling performance improvements -------------------- The Core Text renderer has been rewritten and is now much faster! Scrolling should not stutter and lag like before and generally it should feel a lot smoother now. Thanks to Sidney San Martín (@s4y) for the contribution. #858 With this change, the non-Core-Text renderer is now considered deprecated. The old renderer is accessible either through the Preference Pane (under Advanced) or by setting the defaults "MMRenderer" to 0. It works for now, but it will be removed in a future update as it has known bugs. Menu Localization -------------------- Menus are now localized, see `:h langmenu` for how Vim menu localization works. You can use `set langmenu=none` to turn it off if you would like. #1099 There still exists a few menu items that are not localized, and the general MacVim GUI is not localized as well. If you would like to help, please use #1102 to coordinate with MacVim dev team. Getting help / Help menu -------------------- - Help menu's search bar now searches Vim documentation as well! See #1095. - Vimtutor is now bundled with MacVim, and you can access vimtutor from the Help menu (#1096). There is also a link to the latest release notes as well (#1131). General ==================== - This release does not contain a native universal app for Apple Silicon / M1 Macs yet. The release binary will still work under Rosetta, which should provide enough performance, but if you use Python/etc plugins, you need to make sure you have x86 versions of Python/etc installed (which is still the default for Homebrew as of this release). MacVim is buildable under Apple Silicon, so if you need a native binary, you could build it yourself by downloading the source from the Github repository. See #1136 for progress on releasing a universal app for Apple Silicon. - MacVim has enabled the Github Discussions feature, which serves as a good spot for general discussions and questions. See #1130 and check it out! Fixes ==================== - Launching MacVim from the Dock with locales that use "," for decimal separators now works correctly. #11 (Vim 8.2.1738) - `WinBar` menus (which are used by plugins like vimspector) now work properly and don't create dummy menu items. #918 - Using `:browse tabnew` no longer crashes MacVim in terminal mode. #1107 (Vim 8.2.1842) Misc ==================== - Scripting languages versions: - Python is now built against 3.9, up from 3.8. - Lua is now built against 5.4, up from 5.3. Compatibility ==================== Requires macOS 10.9 or above. Script interfaces have compatibility with these versions: - Lua 5.4 - Perl 5.18 - Python2 2.7 - Python3 3.9 - Ruby 2.7
Updated to Vim 8.2.2127. *Note*: This release doesn't natively support Apple Silicon / M1 yet, but does work under Rosetta. See below. Features ==================== Big Sur / macOS 11 -------------------- - MacVim now has an updated app icon (#1054), and preference pane / toolbars have been updated to match Big Sur's interface guidelines. (#1128) - Fixed Touch Bar warnings when launching MacVim from the terminal. #1114 - SF Symbol characters will show up properly as double-width as most of these icons would take up more than one column. Note that these characters are specific to macOS and would not work in other platforms. #1129 Renderer / scrolling performance improvements -------------------- The Core Text renderer has been rewritten and is now much faster! Scrolling should not stutter and lag like before and generally it should feel a lot smoother now. Thanks to Sidney San Martín (@s4y) for the contribution. #858 With this change, the non-Core-Text renderer is now considered deprecated. The old renderer is accessible either through the Preference Pane (under Advanced) or by setting the defaults "MMRenderer" to 0. It works for now, but it will be removed in a future update as it has known bugs. Menu Localization -------------------- Menus are now localized, see `:h langmenu` for how Vim menu localization works. You can use `set langmenu=none` to turn it off if you would like. #1099 There still exists a few menu items that are not localized, and the general MacVim GUI is not localized as well. If you would like to help, please use #1102 to coordinate with MacVim dev team. Getting help / Help menu -------------------- - Help menu's search bar now searches Vim documentation as well! See #1095. - Vimtutor is now bundled with MacVim, and you can access vimtutor from the Help menu (#1096). There is also a link to the latest release notes as well (#1131). General ==================== - This release does not contain a native universal app for Apple Silicon / M1 Macs yet. The release binary will still work under Rosetta, which should provide enough performance, but if you use Python/etc plugins, you need to make sure you have x86 versions of Python/etc installed (which is still the default for Homebrew as of this release). MacVim is buildable under Apple Silicon, so if you need a native binary, you could build it yourself by downloading the source from the Github repository. See #1136 for progress on releasing a universal app for Apple Silicon. - MacVim has enabled the Github Discussions feature, which serves as a good spot for general discussions and questions. See #1130 and check it out! Fixes ==================== - Launching MacVim from the Dock with locales that use "," for decimal separators now works correctly. #11 (Vim 8.2.1738) - `WinBar` menus (which are used by plugins like vimspector) now work properly and don't create dummy menu items. #918 - Using `:browse tabnew` no longer crashes MacVim in terminal mode. #1107 (Vim 8.2.1842) Misc ==================== - Scripting languages versions: - Python is now built against 3.9, up from 3.8. - Lua is now built against 5.4, up from 5.3. Compatibility ==================== Requires macOS 10.9 or above. Script interfaces have compatibility with these versions: - Lua 5.4 - Perl 5.18 - Python2 2.7 - Python3 3.9 - Ruby 2.7
Describe the bug
When running the TUI MacVim, executing the command 'browse tabnew' crashes Vim.
To Reproduce
Detailed steps to reproduce the behavior:
$ cd macvim/src
$ MacVim/build/Release/MacVim.app/Contents/MacOS/Vim
:browse tabnew
Vim: Caught deadly signal BUS
Vim: Finished.
Bus error: 10
I don't have any Vim plugins. But I couldn't reproduce this problem with --clean.
Expected behavior
The command should fail with the E338 error.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: