Projects
Mega:24.09
vim
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 3
View file
_service:tar_scm:vim.spec
Changed
@@ -14,7 +14,7 @@ Name: vim Epoch: 2 Version: %{baseversion}.%{patchlevel} -Release: 6 +Release: 11 Summary: Vim is a highly configurable text editor for efficiently creating and changing any kind of text. License: Vim and MIT URL: http://www.vim.org @@ -28,6 +28,7 @@ Patch0003: vim-7.4-globalsyntax.patch Patch0004: vim-8.0-copy-paste.patch Patch0005: vim-python3-tests.patch +Patch0006: vim-9.0-spec-recognize-epoch.patch Patch6000: backport-CVE-2023-48233.patch @@ -42,6 +43,13 @@ Patch6009: backport-vim-7.0-rclocation.patch Patch6010: backport-CVE-2024-22667.patch Patch6011: backport-CVE-2023-48232.patch +Patch6012: backport-patch-9.1.0265-console-dialog-cannot-save-unnamed-bu.patch +Patch6013: backport-patch-9.1.0267-File-name-entered-in-GUI-dialog-is-ig.patch +Patch6014: backport-CVE-2024-41965.patch +Patch6015: backport-patch-9.1.0554-bw-leaves-jumplist-and-tagstack-data-.patch +Patch6016: backport-CVE-2024-41957.patch +Patch6017: backport-CVE-2024-43374.patch +Patch6018: backport-CVE-2024-43802.patch Patch9000: bugfix-rm-modify-info-version.patch @@ -449,6 +457,36 @@ %{_mandir}/man1/evim.* %changelog +* Thu Aug 29 2024 wangjiang <app@cameyan.com> - 2:9.0.2092-11 +- Type:CVE +- ID:CVE-2024-43802 +- SUG:NA +- DESC:fix CVE-2024-43802 + +* Wed Aug 21 2024 Funda Wang <fundawang@yeah.net> - 2:9.0.2092-10 +- Type:enhacement +- ID:NA +- SUG:NA +- DESC:Recognize epoch when making spec changelog + +* Fri Aug 16 2024 zhangxianting <zhangxianting@uniontech.com> - 2:9.0.2092-9 +- Type:CVE +- ID:CVE-2024-43374 +- SUG:NA +- DESC:fix CVE-2024-43374 + +* Tue Aug 06 2024 wangjiang <wangjiang37@h-partners.com> - 2:9.0.2092-8 +- Type:CVE +- ID:CVE-2024-41957 CVE-2024-41965 +- SUG:NA +- DESC:fix CVE-2024-41957 CVE-2024-41965 + +* Mon Jul 29 2024 Funda Wang <fundawang@yeah.net> - 2:9.0.2092-7 +- Type:enhacement +- ID:NA +- SUG:NA +- DESC:support newly introduced rpm tags + * Fri Jul 12 2024 wangjiang <wangjiang37@h-partners.com> - 2:9.0.2092-6 - Type:CVE - ID:CVE-2023-48232
View file
_service:tar_scm:backport-CVE-2024-41957.patch
Added
@@ -0,0 +1,43 @@ +From 8a0bbe7b8aad6f8da28dee218c01bc8a0185a2d5 Mon Sep 17 00:00:00 2001 +From: Christian Brabandt <cb@256bit.org> +Date: Thu, 1 Aug 2024 20:16:51 +0200 +Subject: PATCH patch 9.1.0647: security use-after-free in + tagstack_clear_entry + +Problem: security use-after-free in tagstack_clear_entry + (Suyue Guo ) +Solution: Instead of manually calling vim_free() on each of the tagstack + entries, let's use tagstack_clear_entry(), which will + also free the stack, but using the VIM_CLEAR macro, + which prevents a use-after-free by setting those pointers + to NULL + +This addresses CVE-2024-41957 + +Github advisory: +https://github.com/vim/vim/security/advisories/GHSA-f9cr-gv85-hcr4 + +Signed-off-by: Christian Brabandt <cb@256bit.org> +--- + src/window.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/src/window.c b/src/window.c +index 7ca29d46a..70c72bca7 100644 +--- a/src/window.c ++++ b/src/window.c +@@ -5661,10 +5661,7 @@ win_free( + win_free_lsize(wp); + + for (i = 0; i < wp->w_tagstacklen; ++i) +- { +- vim_free(wp->w_tagstacki.tagname); +- vim_free(wp->w_tagstacki.user_data); +- } ++ tagstack_clear_entry(&wp->w_tagstacki); + vim_free(wp->w_localdir); + vim_free(wp->w_prevdir); + +-- +2.33.0 +
View file
_service:tar_scm:backport-CVE-2024-41965.patch
Added
@@ -0,0 +1,42 @@ +From b29f4abcd4b3382fa746edd1d0562b7b48c9de60 Mon Sep 17 00:00:00 2001 +From: Christian Brabandt <cb@256bit.org> +Date: Thu, 1 Aug 2024 22:10:28 +0200 +Subject: PATCH patch 9.1.0648: security double-free in dialog_changed() + +Problem: security double-free in dialog_changed() + (SuyueGuo) +Solution: Only clear pointer b_sfname pointer, if it is different + than the b_ffname pointer. Don't try to free b_fname, + set it to NULL instead. + +fixes: #15403 + +Github Advisory: +https://github.com/vim/vim/security/advisories/GHSA-46pw-v7qw-xc2f + +Signed-off-by: Christian Brabandt <cb@256bit.org> +--- + src/ex_cmds2.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c +index ce30b8d39..0d76b3b27 100644 +--- a/src/ex_cmds2.c ++++ b/src/ex_cmds2.c +@@ -197,9 +197,11 @@ dialog_changed( + // restore to empty when write failed + if (empty_bufname) + { +- VIM_CLEAR(buf->b_fname); ++ // prevent double free ++ if (buf->b_sfname != buf->b_ffname) ++ VIM_CLEAR(buf->b_sfname); ++ buf->b_fname = NULL; + VIM_CLEAR(buf->b_ffname); +- VIM_CLEAR(buf->b_sfname); + unchanged(buf, TRUE, FALSE); + } + } +-- +2.33.0 +
View file
_service:tar_scm:backport-CVE-2024-43374.patch
Added
@@ -0,0 +1,300 @@ +From 0a6e57b09bc8c76691b367a5babfb79b31b770e8 Mon Sep 17 00:00:00 2001 +From: Christian Brabandt <cb@256bit.org> +Date: Thu, 15 Aug 2024 22:15:28 +0200 +Subject: PATCH patch 9.1.0678: security: use-after-free in alist_add() +https://github.com/vim/vim/commit/0a6e57b09bc8c76691b367a5babfb79b31b770e8 + +Problem: security: use-after-free in alist_add() + (SuyueGuo) +Solution: Lock the current window, so that the reference to + the argument list remains valid. + +This fixes CVE-2024-43374 + +Signed-off-by: Christian Brabandt <cb@256bit.org> +--- + src/arglist.c | 6 ++++++ + src/buffer.c | 4 ++-- + src/ex_cmds.c | 4 ++-- + src/proto/window.pro | 1 + + src/structs.h | 2 +- + src/terminal.c | 4 ++-- + src/testdir/test_arglist.vim | 23 +++++++++++++++++++++++ + src/version.c | 2 ++ + src/window.c | 29 +++++++++++++++++++---------- + 9 files changed, 58 insertions(+), 17 deletions(-) + +diff --git a/src/arglist.c b/src/arglist.c +index a63f6c7..050f96f 100644 +--- a/src/arglist.c ++++ b/src/arglist.c +@@ -184,6 +184,8 @@ alist_set( + /* + * Add file "fname" to argument list "al". + * "fname" must have been allocated and "al" must have been checked for room. ++ * ++ * May trigger Buf* autocommands + */ + void + alist_add( +@@ -196,6 +198,7 @@ alist_add( + if (check_arglist_locked() == FAIL) + return; + arglist_locked = TRUE; ++ curwin->w_locked = TRUE; + + #ifdef BACKSLASH_IN_FILENAME + slash_adjust(fname); +@@ -207,6 +210,7 @@ alist_add( + ++al->al_ga.ga_len; + + arglist_locked = FALSE; ++ curwin->w_locked = FALSE; + } + + #if defined(BACKSLASH_IN_FILENAME) || defined(PROTO) +@@ -365,6 +369,7 @@ alist_add_list( + mch_memmove(&(ARGLISTafter + count), &(ARGLISTafter), + (ARGCOUNT - after) * sizeof(aentry_T)); + arglist_locked = TRUE; ++ curwin->w_locked = TRUE; + for (i = 0; i < count; ++i) + { + int flags = BLN_LISTED | (will_edit ? BLN_CURBUF : 0); +@@ -373,6 +378,7 @@ alist_add_list( + ARGLISTafter + i.ae_fnum = buflist_add(filesi, flags); + } + arglist_locked = FALSE; ++ curwin->w_locked = FALSE; + ALIST(curwin)->al_ga.ga_len += count; + if (old_argcount > 0 && curwin->w_arg_idx >= after) + curwin->w_arg_idx += count; +diff --git a/src/buffer.c b/src/buffer.c +index ccd095b..260d22e 100644 +--- a/src/buffer.c ++++ b/src/buffer.c +@@ -1456,7 +1456,7 @@ do_buffer_ext( + // (unless it's the only window). Repeat this so long as we end up in + // a window with this buffer. + while (buf == curbuf +- && !(curwin->w_closing || curwin->w_buffer->b_locked > 0) ++ && !(win_locked(curwin) || curwin->w_buffer->b_locked > 0) + && (!ONE_WINDOW || first_tabpage->tp_next != NULL)) + { + if (win_close(curwin, FALSE) == FAIL) +@@ -5443,7 +5443,7 @@ ex_buffer_all(exarg_T *eap) + : wp->w_width != Columns) + || (had_tab > 0 && wp != firstwin)) + && !ONE_WINDOW +- && !(wp->w_closing || wp->w_buffer->b_locked > 0) ++ && !(win_locked(wp) || wp->w_buffer->b_locked > 0) + && !win_unlisted(wp)) + { + if (win_close(wp, FALSE) == FAIL) +diff --git a/src/ex_cmds.c b/src/ex_cmds.c +index a08682b..46c4503 100644 +--- a/src/ex_cmds.c ++++ b/src/ex_cmds.c +@@ -2827,7 +2827,7 @@ do_ecmd( + + // Set the w_closing flag to avoid that autocommands close the + // window. And set b_locked for the same reason. +- the_curwin->w_closing = TRUE; ++ the_curwin->w_locked = TRUE; + ++buf->b_locked; + + if (curbuf == old_curbuf.br_buf) +@@ -2841,7 +2841,7 @@ do_ecmd( + + // Autocommands may have closed the window. + if (win_valid(the_curwin)) +- the_curwin->w_closing = FALSE; ++ the_curwin->w_locked = FALSE; + --buf->b_locked; + + #ifdef FEAT_EVAL +diff --git a/src/proto/window.pro b/src/proto/window.pro +index cfb771d..12edf0b 100644 +--- a/src/proto/window.pro ++++ b/src/proto/window.pro +@@ -93,4 +93,5 @@ int win_hasvertsplit(void); + int get_win_number(win_T *wp, win_T *first_win); + int get_tab_number(tabpage_T *tp); + char *check_colorcolumn(win_T *wp); ++int win_locked(win_T *wp); + /* vim: set ft=c : */ +diff --git a/src/structs.h b/src/structs.h +index 6d9dcbb..1f4742b 100644 +--- a/src/structs.h ++++ b/src/structs.h +@@ -3740,7 +3740,7 @@ struct window_S + synblock_T *w_s; // for :ownsyntax + #endif + +- int w_closing; // window is being closed, don't let ++ int w_locked; // window is being closed, don't let + // autocommands close it too. + + frame_T *w_frame; // frame containing this window +diff --git a/src/terminal.c b/src/terminal.c +index f79d102..37cd0f2 100644 +--- a/src/terminal.c ++++ b/src/terminal.c +@@ -3669,10 +3669,10 @@ term_after_channel_closed(term_T *term) + if (is_aucmd_win(curwin)) + do_set_w_closing = TRUE; + if (do_set_w_closing) +- curwin->w_closing = TRUE; ++ curwin->w_locked = TRUE; + do_bufdel(DOBUF_WIPE, (char_u *)"", 1, fnum, fnum, FALSE); + if (do_set_w_closing) +- curwin->w_closing = FALSE; ++ curwin->w_locked = FALSE; + aucmd_restbuf(&aco); + } + #ifdef FEAT_PROP_POPUP +diff --git a/src/testdir/test_arglist.vim b/src/testdir/test_arglist.vim +index edc8b77..8d81a82 100644 +--- a/src/testdir/test_arglist.vim ++++ b/src/testdir/test_arglist.vim +@@ -359,6 +359,7 @@ func Test_argv() + call assert_equal('', argv(1, 100)) + call assert_equal(, argv(-1, 100)) + call assert_equal('', argv(10, -1)) ++ %argdelete + endfunc + + " Test for the :argedit command +@@ -744,4 +745,26 @@ func Test_all_command() + %bw! + endfunc + ++" Test for deleting buffer when creating an arglist. This was accessing freed ++" memory ++func Test_crash_arglist_uaf() ++ "%argdelete ++ new one ++ au BufAdd XUAFlocal :bw ++ "call assert_fails(':arglocal XUAFlocal', 'E163:') ++ arglocal XUAFlocal ++ au! BufAdd ++ bw! XUAFlocal ++ ++ au BufAdd XUAFlocal2 :bw ++ new two ++ new three ++ arglocal ++ argadd XUAFlocal2 Xfoobar ++ bw! XUAFlocal2 ++ bw! two ++ ++ au! BufAdd ++endfunc ++ + " vim: shiftwidth=2 sts=2 expandtab +diff --git a/src/version.c b/src/version.c +index 555ef9f..10916ed 100644 +--- a/src/version.c ++++ b/src/version.c +@@ -704,6 +704,8 @@ static char *(features) =
View file
_service:tar_scm:backport-CVE-2024-43802.patch
Added
@@ -0,0 +1,45 @@ +From 322ba9108612bead5eb7731ccb66763dec69ef1b Mon Sep 17 00:00:00 2001 +From: Christian Brabandt <cb@256bit.org> +Date: Sun, 25 Aug 2024 21:33:03 +0200 +Subject: PATCH patch 9.1.0697: security: heap-buffer-overflow in + ins_typebuf + +Problem: heap-buffer-overflow in ins_typebuf + (SuyueGuo) +Solution: When flushing the typeahead buffer, validate that there + is enough space left + +Github Advisory: +https://github.com/vim/vim/security/advisories/GHSA-4ghr-c62x-cqfh + +Signed-off-by: Christian Brabandt <cb@256bit.org> +--- + src/getchar.c | 15 ++++++++++++--- + 1 files changed, 12 insertions(+), 3 deletions(-) + +diff --git a/src/getchar.c b/src/getchar.c +index 29323fa328bd1..96e180f4ae1a9 100644 +--- a/src/getchar.c ++++ b/src/getchar.c +@@ -438,9 +438,18 @@ flush_buffers(flush_buffers_T flush_typeahead) + + if (flush_typeahead == FLUSH_MINIMAL) + { +- // remove mapped characters at the start only +- typebuf.tb_off += typebuf.tb_maplen; +- typebuf.tb_len -= typebuf.tb_maplen; ++ // remove mapped characters at the start only, ++ // but only when enough space left in typebuf ++ if (typebuf.tb_off + typebuf.tb_maplen >= typebuf.tb_buflen) ++ { ++ typebuf.tb_off = MAXMAPLEN; ++ typebuf.tb_len = 0; ++ } ++ else ++ { ++ typebuf.tb_off += typebuf.tb_maplen; ++ typebuf.tb_len -= typebuf.tb_maplen; ++ } + #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL) + if (typebuf.tb_len == 0) + typebuf_was_filled = FALSE;
View file
_service:tar_scm:backport-patch-9.1.0265-console-dialog-cannot-save-unnamed-bu.patch
Added
@@ -0,0 +1,171 @@ +From df46115fc839c8912ed60646e86a412e5180ba1d Mon Sep 17 00:00:00 2001 +From: glepnir <glephunter@gmail.com> +Date: Thu, 4 Apr 2024 22:23:29 +0200 +Subject: PATCH patch 9.1.0265: console dialog cannot save unnamed buffers + +Problem: console dialog cannot save unnamed buffers +Solution: set bufname before save (glepnir). Define dialog_con_gui + to test for GUI+Console dialog support, use it to skip + the test when the GUI feature has been defined. + +Note: The dialog_changed() function will also try to call the +browse_save_fname() function, when FEAT_BROWSE is defined (which is only +defined in a GUI build of Vim). This will eventually lead to a call of +do_browse(), which causes an error message if a GUI is not currently +running (see the TODO: in do_browse()) and will then lead to a failure +in Test_goto_buf_with_onfirm(). + +Therefore, we must disable the Test_goto_buf_with_onfirm(), when the +dialog_con_gui feature is enabled (which basically means dialog feature +for GUI and Console builds, in contrast to the dialog_con and dialog_gui +feature). + +(Previously this wasn't a problem, because the test aborted in the YES +case for the :confirm :b XgotoConf case and did therefore not run into +the browse function call) + +closes: #14398 + +Signed-off-by: glepnir <glephunter@gmail.com> +Signed-off-by: Christian Brabandt <cb@256bit.org> +--- + runtime/doc/builtin.txt | 5 +++-- + src/evalfunc.c | 7 +++++++ + src/ex_cmds2.c | 26 ++++++++++++++++++++++---- + src/testdir/test_buffer.vim | 21 +++++++++++++++------ + 4 files changed, 47 insertions(+), 12 deletions(-) + +diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt +index 6a4c8d981..fb7c794f6 100644 +--- a/runtime/doc/builtin.txt ++++ b/runtime/doc/builtin.txt +@@ -1,4 +1,4 @@ +-*builtin.txt* For Vim version 9.0. Last change: 2023 Sep 27 ++*builtin.txt* For Vim version 9.1. Last change: 2024 Apr 04 + + + VIM REFERENCE MANUAL by Bram Moolenaar +@@ -1761,7 +1761,7 @@ confirm({msg} , {choices} , {default} , {type}) + made. It returns the number of the choice. For the first + choice this is 1. + Note: confirm() is only supported when compiled with dialog +- support, see |+dialog_con| and |+dialog_gui|. ++ support, see |+dialog_con| |+dialog_con_gui| and |+dialog_gui|. + + {msg} is displayed in a |dialog| with {choices} as the + alternatives. When {choices} is missing or empty, "&OK" is +@@ -10912,6 +10912,7 @@ cscope Compiled with |cscope| support. + cursorbind Compiled with |'cursorbind'| (always true) + debug Compiled with "DEBUG" defined. + dialog_con Compiled with console dialog support. ++dialog_con_gui Compiled with console and GUI dialog support. + dialog_gui Compiled with GUI dialog support. + diff Compiled with |vimdiff| and 'diff' support. + digraphs Compiled with support for digraphs. +diff --git a/src/evalfunc.c b/src/evalfunc.c +index 0e071d87b..20649828e 100644 +--- a/src/evalfunc.c ++++ b/src/evalfunc.c +@@ -5792,6 +5792,13 @@ f_has(typval_T *argvars, typval_T *rettv) + 1 + #else + 0 ++#endif ++ }, ++ {"dialog_con_gui", ++#if defined(FEAT_CON_DIALOG) && defined(FEAT_GUI_DIALOG) ++ 1 ++#else ++ 0 + #endif + }, + {"dialog_gui", +diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c +index 4a6f51923..a75bfc11c 100644 +--- a/src/ex_cmds2.c ++++ b/src/ex_cmds2.c +@@ -163,7 +163,8 @@ dialog_changed( + char_u buffDIALOG_MSG_SIZE; + int ret; + buf_T *buf2; +- exarg_T ea; ++ exarg_T ea; ++ int empty_buf = buf->b_fname == NULL ? TRUE : FALSE; + + dialog_msg(buff, _("Save changes to \"%s\"?"), buf->b_fname); + if (checkall) +@@ -181,10 +182,27 @@ dialog_changed( + // May get file name, when there is none + browse_save_fname(buf); + #endif +- if (buf->b_fname != NULL && check_overwrite(&ea, buf, +- buf->b_fname, buf->b_ffname, FALSE) == OK) ++ if (empty_buf) ++ buf_set_name(buf->b_fnum, (char_u *)"Untitled"); ++ ++ if (check_overwrite(&ea, buf, buf->b_fname, buf->b_ffname, FALSE) == OK) ++ { + // didn't hit Cancel +- (void)buf_write_all(buf, FALSE); ++ if (buf_write_all(buf, FALSE) == OK) ++ return; ++ } ++ ++ // restore to empty when write failed ++ if (empty_buf) ++ { ++ vim_free(buf->b_fname); ++ buf->b_fname = NULL; ++ vim_free(buf->b_ffname); ++ buf->b_ffname = NULL; ++ vim_free(buf->b_sfname); ++ buf->b_sfname = NULL; ++ unchanged(buf, TRUE, FALSE); ++ } + } + else if (ret == VIM_NO) + { +diff --git a/src/testdir/test_buffer.vim b/src/testdir/test_buffer.vim +index a5643b3bb..de088bd8e 100644 +--- a/src/testdir/test_buffer.vim ++++ b/src/testdir/test_buffer.vim +@@ -252,21 +252,30 @@ func Test_goto_buf_with_confirm() + CheckUnix + CheckNotGui + CheckFeature dialog_con ++ " When dialog_con_gui is defined, Vim is compiled with GUI support ++ " and FEAT_BROWSE will be defined, which causes :confirm :b to ++ " call do_browse(), which will try to use a GUI file browser, ++ " which aborts if a GUI is not available. ++ CheckNotFeature dialog_con_gui + new XgotoConf + enew + call setline(1, 'test') + call assert_fails('b XgotoConf', 'E37:') + call feedkeys('c', 'L') + call assert_fails('confirm b XgotoConf', 'E37:') +- call assert_equal(1, &modified) +- call assert_equal('', @%) ++ call assert_true(&modified) ++ call assert_true(empty(bufname('%'))) + call feedkeys('y', 'L') +- call assert_fails('confirm b XgotoConf', '', 'E37:') +- call assert_equal(1, &modified) +- call assert_equal('', @%) ++ confirm b XgotoConf ++ call assert_equal('XgotoConf', bufname('%')) ++ call assert_equal('test', readfile('Untitled')) ++ e Untitled ++ call setline(2, 'test2') + call feedkeys('n', 'L') + confirm b XgotoConf +- call assert_equal('XgotoConf', @%) ++ call assert_equal('XgotoConf', bufname('%')) ++ call assert_equal('test', readfile('Untitled')) ++ call delete('Untitled') + close! + endfunc + +-- +2.33.0 +
View file
_service:tar_scm:backport-patch-9.1.0267-File-name-entered-in-GUI-dialog-is-ig.patch
Added
@@ -0,0 +1,67 @@ +From c20bdf1107d48a1c14713709d12d429e761132af Mon Sep 17 00:00:00 2001 +From: zeertzjq <zeertzjq@outlook.com> +Date: Fri, 5 Apr 2024 20:02:55 +0200 +Subject: PATCH patch 9.1.0267: File name entered in GUI dialog is ignored + +Problem: File name entered in GUI dialog is ignored (after v9.1.0265) +Solution: Only set file name to "Untitled" if GUI dialog didn't set it. + (zeertzjq) + +closes: #14417 + +Signed-off-by: zeertzjq <zeertzjq@outlook.com> +Signed-off-by: Christian Brabandt <cb@256bit.org> +--- + src/ex_cmds2.c | 17 ++++++++--------- + 1 file changed, 8 insertions(+), 9 deletions(-) + +diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c +index a75bfc11c..ce30b8d39 100644 +--- a/src/ex_cmds2.c ++++ b/src/ex_cmds2.c +@@ -164,7 +164,6 @@ dialog_changed( + int ret; + buf_T *buf2; + exarg_T ea; +- int empty_buf = buf->b_fname == NULL ? TRUE : FALSE; + + dialog_msg(buff, _("Save changes to \"%s\"?"), buf->b_fname); + if (checkall) +@@ -178,11 +177,14 @@ dialog_changed( + + if (ret == VIM_YES) + { ++ int empty_bufname; ++ + #ifdef FEAT_BROWSE + // May get file name, when there is none + browse_save_fname(buf); + #endif +- if (empty_buf) ++ empty_bufname = buf->b_fname == NULL ? TRUE : FALSE; ++ if (empty_bufname) + buf_set_name(buf->b_fnum, (char_u *)"Untitled"); + + if (check_overwrite(&ea, buf, buf->b_fname, buf->b_ffname, FALSE) == OK) +@@ -193,14 +195,11 @@ dialog_changed( + } + + // restore to empty when write failed +- if (empty_buf) ++ if (empty_bufname) + { +- vim_free(buf->b_fname); +- buf->b_fname = NULL; +- vim_free(buf->b_ffname); +- buf->b_ffname = NULL; +- vim_free(buf->b_sfname); +- buf->b_sfname = NULL; ++ VIM_CLEAR(buf->b_fname); ++ VIM_CLEAR(buf->b_ffname); ++ VIM_CLEAR(buf->b_sfname); + unchanged(buf, TRUE, FALSE); + } + } +-- +2.33.0 +
View file
_service:tar_scm:backport-patch-9.1.0554-bw-leaves-jumplist-and-tagstack-data-.patch
Added
@@ -0,0 +1,237 @@ +From 4ff3a9b1e3ba45f9dbd0ea8c721f27d9315c4d93 Mon Sep 17 00:00:00 2001 +From: LemonBoy <thatlemon@gmail.com> +Date: Tue, 9 Jul 2024 20:03:24 +0200 +Subject: PATCH patch 9.1.0554: :bw leaves jumplist and tagstack data around + +Problem: :bw leaves jumplist and tagstack data around + (Paul "Joey" Clark) +Solution: Wipe jumplist and tagstack references to the wiped buffer + (LemonBoy) + +As documented the :bwipeout command brutally deletes all the references +to the buffer, so let's make it delete all the entries in the jump list +and tag stack referring to the wiped-out buffer. + +fixes: #8201 +closes: #15185 + +Signed-off-by: LemonBoy <thatlemon@gmail.com> +Signed-off-by: Christian Brabandt <cb@256bit.org> +--- + runtime/doc/version9.txt | 1 + + runtime/doc/windows.txt | 5 +++-- + src/buffer.c | 5 +++++ + src/mark.c | 34 ++++++++++++++++++++++++++++++++++ + src/proto/mark.pro | 1 + + src/proto/tag.pro | 1 + + src/tag.c | 3 +-- + src/testdir/test_jumplist.vim | 22 ++++++---------------- + src/testdir/test_tagjump.vim | 17 +++++++++++++++++ + 9 files changed, 69 insertions(+), 20 deletions(-) + +diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt +index 9cf20300f..df56215ea 100644 +--- a/runtime/doc/version9.txt ++++ b/runtime/doc/version9.txt +@@ -31701,6 +31701,7 @@ Other improvements *new-other-9.1* + + Changed *changed-9.1* + ------- ++- |:bwipe| also wipes jumplist and tagstack data + + Added *added-9.1* + ----- +diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt +index e264e5117..d3e5f6785 100644 +--- a/runtime/doc/windows.txt ++++ b/runtime/doc/windows.txt +@@ -1,4 +1,4 @@ +-*windows.txt* For Vim version 9.0. Last change: 2022 Nov 27 ++*windows.txt* For Vim version 9.1. Last change: 2024 Jul 09 + + + VIM REFERENCE MANUAL by Bram Moolenaar +@@ -1225,7 +1225,8 @@ list of buffers. |unlisted-buffer| + :bwipeout! N1 N2 ... + Like |:bdelete|, but really delete the buffer. Everything + related to the buffer is lost. All marks in this buffer +- become invalid, option settings are lost, etc. Don't use this ++ become invalid, option settings are lost, the jumplist and ++ tagstack data will be purged, etc. Don't use this + unless you know what you are doing. Examples: > + :.+,$bwipeout " wipe out all buffers after the current + " one +diff --git a/src/buffer.c b/src/buffer.c +index cbec9b980..28967342d 100644 +--- a/src/buffer.c ++++ b/src/buffer.c +@@ -750,10 +750,15 @@ aucmd_abort: + */ + if (wipe_buf) + { ++ win_T *wp; ++ + // Do not wipe out the buffer if it is used in a window. + if (buf->b_nwindows > 0) + return FALSE; + ++ FOR_ALL_WINDOWS(wp) ++ mark_forget_file(wp, buf->b_fnum); ++ + if (action == DOBUF_WIPE_REUSE) + { + // we can re-use this buffer number, store it +diff --git a/src/mark.c b/src/mark.c +index 22e3c6257..85f7b68e2 100644 +--- a/src/mark.c ++++ b/src/mark.c +@@ -129,6 +129,40 @@ setmark_pos(int c, pos_T *pos, int fnum) + return FAIL; + } + ++/* ++ * Delete every entry referring to file 'fnum' from both the jumplist and the ++ * tag stack. ++ */ ++ void ++mark_forget_file(win_T *wp, int fnum) ++{ ++ int i; ++ ++ for (i = 0; i < wp->w_jumplistlen; ++i) ++ if (wp->w_jumplisti.fmark.fnum == fnum) ++ { ++ vim_free(wp->w_jumplisti.fname); ++ mch_memmove(&wp->w_jumplisti, &wp->w_jumplisti + 1, ++ (wp->w_jumplistlen - i - 1) * sizeof(xfmark_T)); ++ if (wp->w_jumplistidx > i) ++ --wp->w_jumplistidx; ++ --wp->w_jumplistlen; ++ --i; ++ } ++ ++ for (i = 0; i < wp->w_tagstacklen; i++) ++ if (wp->w_tagstacki.fmark.fnum == fnum) ++ { ++ tagstack_clear_entry(&wp->w_tagstacki); ++ mch_memmove(&wp->w_tagstacki, &wp->w_tagstacki + 1, ++ (wp->w_tagstacklen - i - 1) * sizeof(taggy_T)); ++ if (wp->w_tagstackidx > i) ++ --wp->w_tagstackidx; ++ --wp->w_tagstacklen; ++ --i; ++ } ++} ++ + /* + * Set the previous context mark to the current position and add it to the + * jump list. +diff --git a/src/proto/mark.pro b/src/proto/mark.pro +index cc45f0d3c..d398c3677 100644 +--- a/src/proto/mark.pro ++++ b/src/proto/mark.pro +@@ -28,4 +28,5 @@ void set_last_cursor(win_T *win); + void free_all_marks(void); + xfmark_T *get_namedfm(void); + void f_getmarklist(typval_T *argvars, typval_T *rettv); ++void mark_forget_file(win_T *wp, int fnum); + /* vim: set ft=c : */ +diff --git a/src/proto/tag.pro b/src/proto/tag.pro +index 6de463e92..eec7c24ed 100644 +--- a/src/proto/tag.pro ++++ b/src/proto/tag.pro +@@ -14,4 +14,5 @@ int expand_tags(int tagnames, char_u *pat, int *num_file, char_u ***file); + int get_tags(list_T *list, char_u *pat, char_u *buf_fname); + void get_tagstack(win_T *wp, dict_T *retdict); + int set_tagstack(win_T *wp, dict_T *d, int action); ++void tagstack_clear_entry(taggy_T *item); + /* vim: set ft=c : */ +diff --git a/src/tag.c b/src/tag.c +index d406fdec1..57f9fe016 100644 +--- a/src/tag.c ++++ b/src/tag.c +@@ -144,7 +144,6 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char_ + #if defined(FEAT_QUICKFIX) && defined(FEAT_EVAL) + static int add_llist_tags(char_u *tag, int num_matches, char_u **matches); + #endif +-static void tagstack_clear_entry(taggy_T *item); + + static char_u *tagmatchname = NULL; // name of last used tag + +@@ -4225,7 +4224,7 @@ find_extra(char_u **pp) + /* + * Free a single entry in a tag stack + */ +- static void ++ void + tagstack_clear_entry(taggy_T *item) + { + VIM_CLEAR(item->tagname); +diff --git a/src/testdir/test_jumplist.vim b/src/testdir/test_jumplist.vim +index 8fbf39f55..0f43a8c6e 100644 +--- a/src/testdir/test_jumplist.vim ++++ b/src/testdir/test_jumplist.vim +@@ -62,26 +62,16 @@ endfunc + func Test_jumplist_invalid() + new + clearjumps +- " put some randome text +- put ='a' +- let prev = bufnr('%') ++ " Put some random text and fill the jump list. ++ call setline(1, 'foo', 'bar', 'baz') ++ normal G ++ normal gg + setl nomodified bufhidden=wipe + e XXJumpListBuffer +- let bnr = bufnr('%') +- " 1) empty jumplist +- let expected = +- \ {'lnum': 2, 'bufnr': prev, 'col': 0, 'coladd': 0}, 1 +- call assert_equal(expected, getjumplist()) ++ " The jump list is empty as the buffer was wiped out. ++ call assert_equal(, 0, getjumplist()) + let jumps = execute(':jumps') + call assert_equal('>', jumps-1:) +- " now jump back +- exe ":norm! \<c-o>" +- let expected = +- \ {'lnum': 2, 'bufnr': prev, 'col': 0, 'coladd': 0},
View file
_service:tar_scm:vim-7.4-globalsyntax.patch
Changed
@@ -6,8 +6,8 @@ syn region specPackageArea matchgroup=specSection start='^%package' end='^%'me=e-1 contains=specPackageOpts,specPreAmble,specComment "%% Scripts Section %% --syn region specScriptArea matchgroup=specSection start='^%\(prep\|build\|install\|clean\|check\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|autosetup\|autopatch\|find_lang\|make_build\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2 -+syn region specScriptArea matchgroup=specSection start='^%\(prep\|build\|install\|clean\|check\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|global\|patch\d*\|configure\|GNUconfigure\|setup\|autosetup\|autopatch\|find_lang\|make_build\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2 +-syn region specScriptArea matchgroup=specSection start='^%\(generate_buildrequires\|prep\|conf\|build\|install\|clean\|check\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|autosetup\|autopatch\|find_lang\|make_build\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2 ++syn region specScriptArea matchgroup=specSection start='^%\(generate_buildrequires\|prep\|conf\|build\|install\|clean\|check\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|global\|patch\d*\|configure\|GNUconfigure\|setup\|autosetup\|autopatch\|find_lang\|make_build\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2 "%% Changelog Section %% syn region specChangelogArea matchgroup=specSection start='^%changelog' end='^%'me=e-1 contains=specEmail,specURL,specWeekday,specMonth,specNumber,specComment,specLicense
View file
_service:tar_scm:vim-7.4-specsyntax.patch
Changed
@@ -1,7 +1,7 @@ diff -up vim74/runtime/syntax/spec.vim.highlite vim74/runtime/syntax/spec.vim --- vim74/runtime/syntax/spec.vim.highlite 2016-07-04 10:17:45.000000000 +0200 +++ vim74/runtime/syntax/spec.vim 2016-08-04 15:20:26.116049343 +0200 -@@ -35,7 +35,7 @@ syn match specNoNumberHilite 'X11\|X11R6\|a-zA-Z*\.\d\|a-zA-Z-/\d' +@@ -35,7 +35,7 @@ syn match specManpageFile 'a-zA-Z\.1' "Day, Month and most used license acronyms @@ -10,7 +10,7 @@ syn keyword specWeekday contained Mon Tue Wed Thu Fri Sat Sun syn keyword specMonth contained Jan Feb Mar Apr Jun Jul Aug Sep Oct Nov Dec syn keyword specMonth contained January February March April May June July August September October November December -@@ -58,9 +58,9 @@ syn cluster specListedFiles contains=specListedFilesBin,specListedFilesLib,specL +@@ -58,9 +58,9 @@ "specCommands syn match specConfigure contained '\./configure' @@ -22,7 +22,7 @@ syn cluster specCommands contains=specCommand,specTarCommand,specConfigure,specCommandSpecial "frequently used rpm env vars -@@ -102,7 +102,7 @@ syn case ignore +@@ -102,7 +102,7 @@ "%% PreAmble Section %% "Copyright and Serial were deprecated by License and Epoch syn region specPreAmbleDeprecated oneline matchgroup=specError start='^\(Copyright\|Serial\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier @@ -31,3 +31,12 @@ "%% Description Section %% syn region specDescriptionArea matchgroup=specSection start='^%description' end='^%'me=e-1 contains=specDescriptionOpts,specEmail,specURL,specNumber,specMacroIdentifier,specComment +@@ -111,7 +111,7 @@ + syn region specPackageArea matchgroup=specSection start='^%package' end='^%'me=e-1 contains=specPackageOpts,specPreAmble,specComment + + "%% Scripts Section %% +-syn region specScriptArea matchgroup=specSection start='^%\(prep\|build\|install\|clean\|check\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|autosetup\|autopatch\|find_lang\|make_build\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2 ++syn region specScriptArea matchgroup=specSection start='^%\(generate_buildrequires\|prep\|conf\|build\|install\|clean\|check\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|autosetup\|autopatch\|find_lang\|make_build\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2 + + "%% Changelog Section %% + syn region specChangelogArea matchgroup=specSection start='^%changelog' end='^%'me=e-1 contains=specEmail,specURL,specWeekday,specMonth,specNumber,specComment,specLicense
View file
_service:tar_scm:vim-9.0-spec-recognize-epoch.patch
Added
@@ -0,0 +1,42 @@ +--- a/runtime/ftplugin/spec.vim 2024-08-14 23:54:55.965484666 +0800 ++++ b/runtime/ftplugin/spec.vim 2024-08-14 23:53:19.990361345 +0800 +@@ -66,9 +65,11 @@ + endif + let line = 0 + let name = "" ++ let epoch = "" + let ver = "" + let rel = "" + let nameline = -1 ++ let epochline = -1 + let verline = -1 + let relline = -1 + let chgline = -1 +@@ -77,6 +78,9 @@ + if name == "" && linestr =~? '^Name:' + let nameline = line + let name = substitute(strpart(linestr,5), '^ *\(^ \+\) *$','\1','') ++ elseif epoch == "" && linestr =~? '^Epoch:' ++ let epochline = line ++ let epoch = substitute(strpart(linestr,6), '^ *\(^ \+\) *$','\1','') + elseif ver == "" && linestr =~? '^Version:' + let verline = line + let ver = substitute(strpart(linestr,8), '^ *\(^ \+\) *$','\1','') +@@ -93,6 +97,7 @@ + if nameline != -1 && verline != -1 && relline != -1 + let include_release_info = exists("g:spec_chglog_release_info") + let name = s:ParseRpmVars(name, nameline) ++ let epoch = s:ParseRpmVars(epoch, epochline) + let ver = s:ParseRpmVars(ver, verline) + let rel = s:ParseRpmVars(rel, relline) + else +@@ -117,6 +122,9 @@ + if chgline != -1 + let tmptime = v:lc_time + language time C ++ if strlen(epoch) ++ let ver = epoch.":".ver ++ endif + let parsed_format = "* ".strftime(format)." - ".ver."-".rel + execute "language time" tmptime + let release_info = "+ ".name."-".ver."-".rel
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2