summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/patches/Fix-GH-267-where-indent-after-a-sub-would-not-work.patch22
-rw-r--r--debian/patches/debian/Add-recognition-of-more-LaTeX-commands-for-tex-filetype-d.patch27
-rw-r--r--debian/patches/debian/Detect-the-rst-filetype-using-the-contents-of-the-file.patch28
-rw-r--r--debian/patches/debian/Document-Debian-s-decision-to-disable-modelines-by-defaul.patch29
-rw-r--r--debian/patches/debian/Support-sourcing-a-vimrc.tiny-when-Vim-is-invoked-as-vi.patch101
-rw-r--r--debian/patches/patch-9.0.1499-using-uninitialized-memory-with-fuzzy-matc.patch147
-rw-r--r--debian/patches/series6
7 files changed, 360 insertions, 0 deletions
diff --git a/debian/patches/Fix-GH-267-where-indent-after-a-sub-would-not-work.patch b/debian/patches/Fix-GH-267-where-indent-after-a-sub-would-not-work.patch
new file mode 100644
index 0000000..8124aea
--- /dev/null
+++ b/debian/patches/Fix-GH-267-where-indent-after-a-sub-would-not-work.patch
@@ -0,0 +1,22 @@
+From: Andy Lester <andy@petdance.com>
+Date: Tue, 26 Apr 2022 20:07:43 -0500
+Subject: Fix GH#267 where indent after a sub would not work
+
+Closes: #1034529
+Signed-off-by: James McCoy <jamessan@debian.org>
+---
+ runtime/indent/perl.vim | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/runtime/indent/perl.vim b/runtime/indent/perl.vim
+index 4c91fa1..bd2a1a9 100644
+--- a/runtime/indent/perl.vim
++++ b/runtime/indent/perl.vim
+@@ -133,6 +133,7 @@ function! GetPerlIndent()
+ \ || synid == "perlHereDoc"
+ \ || synid == "perlBraces"
+ \ || synid == "perlStatementIndirObj"
++ \ || synid == "perlSubDeclaration"
+ \ || synid =~ "^perlFiledescStatement"
+ \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
+ let brace = strpart(line, bracepos, 1)
diff --git a/debian/patches/debian/Add-recognition-of-more-LaTeX-commands-for-tex-filetype-d.patch b/debian/patches/debian/Add-recognition-of-more-LaTeX-commands-for-tex-filetype-d.patch
new file mode 100644
index 0000000..2d703d1
--- /dev/null
+++ b/debian/patches/debian/Add-recognition-of-more-LaTeX-commands-for-tex-filetype-d.patch
@@ -0,0 +1,27 @@
+From: Stefano Zacchiroli <zack@debian.org>
+Date: Fri, 25 Aug 2006 13:33:04 +0200
+Subject: Add recognition of more LaTeX commands for tex filetype detection
+
+Since filetype detection of TeX files defaults to plaintex, we've added
+detection of some additional LaTeX commands to help sway the detection
+to LaTeX.
+
+Closes: #384479
+Signed-off-by: James McCoy <jamessan@debian.org>
+---
+ runtime/autoload/dist/ft.vim | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
+index bfc325d..7d1e15f 100644
+--- a/runtime/autoload/dist/ft.vim
++++ b/runtime/autoload/dist/ft.vim
+@@ -935,7 +935,7 @@ export def FTtex()
+ var firstNC = search('^\s*[^[:space:]%]', 'c', 1000)
+ if firstNC > 0
+ # Check the next thousand lines for a LaTeX or ConTeXt keyword.
+- var lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>'
++ var lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>\|renewcommand\>\|part\>\|chapter\>\|section\>\|subsection\>\|subsubsection\>\|paragraph\>\|subparagraph\>\|subsubparagraph'
+ var cpat = 'start\a\+\|setup\a\+\|usemodule\|enablemode\|enableregime\|setvariables\|useencoding\|usesymbols\|stelle\a\+\|verwende\a\+\|stel\a\+\|gebruik\a\+\|usa\a\+\|imposta\a\+\|regle\a\+\|utilisemodule\>'
+ var kwline = search('^\s*\\\%(' .. lpat .. '\)\|^\s*\\\(' .. cpat .. '\)',
+ 'cnp', firstNC + 1000)
diff --git a/debian/patches/debian/Detect-the-rst-filetype-using-the-contents-of-the-file.patch b/debian/patches/debian/Detect-the-rst-filetype-using-the-contents-of-the-file.patch
new file mode 100644
index 0000000..f535de8
--- /dev/null
+++ b/debian/patches/debian/Detect-the-rst-filetype-using-the-contents-of-the-file.patch
@@ -0,0 +1,28 @@
+From: James Vega <jamessan@debian.org>
+Date: Fri, 18 Aug 2006 09:06:20 -0400
+Subject: Detect the rst filetype using the contents of the file
+
+Closes: #382541
+---
+ runtime/autoload/dist/script.vim | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/runtime/autoload/dist/script.vim b/runtime/autoload/dist/script.vim
+index f86c428..a1162b1 100644
+--- a/runtime/autoload/dist/script.vim
++++ b/runtime/autoload/dist/script.vim
+@@ -380,6 +380,14 @@ def DetectFromText(line1: string)
+ elseif line1 =~ 'exec\s\+\S*scheme' || line2 =~ 'exec\s\+\S*scheme'
+ set ft=scheme
+
++ # rst files
++ elseif line1 =~ '^\.\.\s\|^\s*restindex\s*$'
++ || line2 =~ '^\.\.\s\|^\s*restindex\s*$'
++ || line3 =~ '^\.\.\s\|^\s*restindex\s*$'
++ || line4 =~ '^\.\.\s\|^\s*restindex\s*$'
++ || line5 =~ '^\.\.\s\|^\s*restindex\s*$'
++ set ft=rst
++
+ # Git output
+ elseif line1 =~ '^\(commit\|tree\|object\) \x\{40,\}\>\|^tag \S\+$'
+ set ft=git
diff --git a/debian/patches/debian/Document-Debian-s-decision-to-disable-modelines-by-defaul.patch b/debian/patches/debian/Document-Debian-s-decision-to-disable-modelines-by-defaul.patch
new file mode 100644
index 0000000..6be3a21
--- /dev/null
+++ b/debian/patches/debian/Document-Debian-s-decision-to-disable-modelines-by-defaul.patch
@@ -0,0 +1,29 @@
+From: James Vega <jamessan@debian.org>
+Date: Thu, 27 Mar 2008 03:42:02 +0000
+Subject: Document Debian's decision to disable modelines by default
+
+Modelines have historically been a source of vulnerabilities in Vim.
+As long as it remains a "blacklist suspected/proven dangerous options"
+instead of a "whitelist allowed options" piece of functionality,
+Debian's system-wide vimrc will maintain this setting. As such, the
+documentation needs to be updated to reflect the induced behavior.
+
+Closes: #472522
+Signed-off-by: James McCoy <jamessan@debian.org>
+---
+ runtime/doc/options.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
+index 4f0ac45..29991e2 100644
+--- a/runtime/doc/options.txt
++++ b/runtime/doc/options.txt
+@@ -5510,7 +5510,7 @@ A jump table for the options with a short description can be found at |Q_op|.
+
+ *'modeline'* *'ml'* *'nomodeline'* *'noml'*
+ 'modeline' 'ml' boolean (Vim default: on (off for root),
+- Vi default: off)
++ Debian: off, Vi default: off)
+ local to buffer
+ If 'modeline' is on 'modelines' gives the number of lines that is
+ checked for set commands. If 'modeline' is off or 'modelines' is zero
diff --git a/debian/patches/debian/Support-sourcing-a-vimrc.tiny-when-Vim-is-invoked-as-vi.patch b/debian/patches/debian/Support-sourcing-a-vimrc.tiny-when-Vim-is-invoked-as-vi.patch
new file mode 100644
index 0000000..74c2f85
--- /dev/null
+++ b/debian/patches/debian/Support-sourcing-a-vimrc.tiny-when-Vim-is-invoked-as-vi.patch
@@ -0,0 +1,101 @@
+From: James McCoy <jamessan@debian.org>
+Date: Tue, 6 Oct 2015 23:46:30 -0400
+Subject: Support sourcing a vimrc.tiny when Vim is invoked as vi
+
+This is used only in the vim-tiny package to allow a specific
+configuration for vim-tiny's vi. The vim-tiny package is substantially
+different from other Vim packages, so it does not make sense to
+share the same config.
+
+Closes: #222138
+Signed-off-by: Stefano Zacchiroli <zack@debian.org>
+Signed-off-by: James Vega <jamessan@debian.org>
+---
+ src/main.c | 23 ++++++++++++++++++++++-
+ src/os_unix.h | 3 +++
+ src/structs.h | 3 +++
+ 3 files changed, 28 insertions(+), 1 deletion(-)
+
+diff --git a/src/main.c b/src/main.c
+index d1c42ed..c3e6bda 100644
+--- a/src/main.c
++++ b/src/main.c
+@@ -1929,6 +1929,10 @@ parse_command_name(mparm_T *parmp)
+ }
+ else if (STRNICMP(initstr, "vim", 3) == 0)
+ initstr += 3;
++#ifdef SYS_TINYRC_FILE
++ else if (STRNICMP(initstr, "vi", 2) == 0)
++ parmp->vi_mode = TRUE;
++#endif
+
+ // Catch "[r][g]vimdiff" and "[r][g]viewdiff".
+ if (STRICMP(initstr, "diff") == 0)
+@@ -3224,7 +3228,12 @@ source_startup_scripts(mparm_T *parmp)
+ * Get system wide defaults, if the file name is defined.
+ */
+ #ifdef SYS_VIMRC_FILE
+- (void)do_source((char_u *)SYS_VIMRC_FILE, FALSE, DOSO_NONE, NULL);
++# if defined(SYS_TINYRC_FILE) && defined(TINY_VIMRC)
++ if (parmp->vi_mode)
++ (void)do_source((char_u *)SYS_TINYRC_FILE, FALSE, DOSO_NONE, NULL);
++ else
++# endif
++ (void)do_source((char_u *)SYS_VIMRC_FILE, FALSE, DOSO_NONE, NULL);
+ #endif
+ #ifdef MACOS_X
+ (void)do_source((char_u *)"$VIMRUNTIME/macmap.vim", FALSE,
+@@ -3263,13 +3272,25 @@ source_startup_scripts(mparm_T *parmp)
+ #ifdef USR_EXRC_FILE2
+ && do_source((char_u *)USR_EXRC_FILE2, FALSE,
+ DOSO_NONE, NULL) == FAIL
++#endif
++#if defined(SYS_TINYRC_FILE) && defined(TINY_VIMRC)
++ && !parmp->vi_mode
+ #endif
+ && !has_dash_c_arg)
+ {
+ // When no .vimrc file was found: source defaults.vim.
+ if (do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE,
+ NULL) == FAIL)
++ {
++ /*
++ * If running as the vim.tiny executable, regardless how what argv[0] is, we
++ * don't want to error due to missing defaults.vim. That's provided by
++ * vim-runtime, which isn't typically installed with vim-tiny.
++ */
++#ifndef TINY_VIMRC
+ emsg(e_failed_to_source_defaults);
++#endif
++ }
+ }
+ }
+
+diff --git a/src/os_unix.h b/src/os_unix.h
+index d87ec90..3f5ce0f 100644
+--- a/src/os_unix.h
++++ b/src/os_unix.h
+@@ -205,6 +205,9 @@ typedef struct dsc$descriptor DESC;
+ /*
+ * Unix system-dependent file names
+ */
++#ifndef SYS_TINYRC_FILE
++# define SYS_TINYRC_FILE "$VIM/vimrc.tiny"
++#endif
+ #ifndef SYS_VIMRC_FILE
+ # define SYS_VIMRC_FILE "$VIM/vimrc"
+ #endif
+diff --git a/src/structs.h b/src/structs.h
+index 46a71cb..ac661a6 100644
+--- a/src/structs.h
++++ b/src/structs.h
+@@ -4468,6 +4468,9 @@ typedef struct
+ #ifdef FEAT_DIFF
+ int diff_mode; // start with 'diff' set
+ #endif
++#ifdef SYS_TINYRC_FILE
++ int vi_mode; /* started as "vi" */
++#endif
+ } mparm_T;
+
+ /*
diff --git a/debian/patches/patch-9.0.1499-using-uninitialized-memory-with-fuzzy-matc.patch b/debian/patches/patch-9.0.1499-using-uninitialized-memory-with-fuzzy-matc.patch
new file mode 100644
index 0000000..92bc3b1
--- /dev/null
+++ b/debian/patches/patch-9.0.1499-using-uninitialized-memory-with-fuzzy-matc.patch
@@ -0,0 +1,147 @@
+From: Bram Moolenaar <Bram@vim.org>
+Date: Sat, 29 Apr 2023 21:38:04 +0100
+Subject: patch 9.0.1499: using uninitialized memory with fuzzy matching
+
+Problem: Using uninitialized memory with fuzzy matching.
+Solution: Initialize the arrays used to store match positions.
+
+Closes: #1035323
+---
+ src/quickfix.c | 5 ++++-
+ src/search.c | 17 +++++++----------
+ src/testdir/test_matchfuzzy.vim | 27 +++++++++++++++++++++++++++
+ src/version.c | 2 ++
+ 4 files changed, 40 insertions(+), 11 deletions(-)
+
+diff --git a/src/quickfix.c b/src/quickfix.c
+index 63dd541..799c243 100644
+--- a/src/quickfix.c
++++ b/src/quickfix.c
+@@ -6058,6 +6058,8 @@ vgr_match_buflines(
+ long lnum;
+ colnr_T col;
+ int pat_len = (int)STRLEN(spat);
++ if (pat_len > MAX_FUZZY_MATCHES)
++ pat_len = MAX_FUZZY_MATCHES;
+
+ for (lnum = 1; lnum <= buf->b_ml.ml_line_count && *tomatch > 0; ++lnum)
+ {
+@@ -6066,7 +6068,7 @@ vgr_match_buflines(
+ {
+ // Regular expression match
+ while (vim_regexec_multi(regmatch, curwin, buf, lnum,
+- col, NULL) > 0)
++ col, NULL) > 0)
+ {
+ // Pass the buffer number so that it gets used even for a
+ // dummy buffer, unless duplicate_name is set, then the
+@@ -6112,6 +6114,7 @@ vgr_match_buflines(
+ int_u sz = ARRAY_LENGTH(matches);
+
+ // Fuzzy string match
++ CLEAR_FIELD(matches);
+ while (fuzzy_match(str + col, spat, FALSE, &score, matches, sz) > 0)
+ {
+ // Pass the buffer number so that it gets used even for a
+diff --git a/src/search.c b/src/search.c
+index 1e4464b..619032c 100644
+--- a/src/search.c
++++ b/src/search.c
+@@ -4422,14 +4422,14 @@ fuzzy_match_recursive(
+ // Found match
+ if (vim_tolower(c1) == vim_tolower(c2))
+ {
+- int_u recursiveMatches[MAX_FUZZY_MATCHES];
+- int recursiveScore = 0;
+- char_u *next_char;
+-
+ // Supplied matches buffer was too short
+ if (nextMatch >= maxMatches)
+ return 0;
+
++ int recursiveScore = 0;
++ int_u recursiveMatches[MAX_FUZZY_MATCHES];
++ CLEAR_FIELD(recursiveMatches);
++
+ // "Copy-on-Write" srcMatches into matches
+ if (first_match && srcMatches)
+ {
+@@ -4438,10 +4438,7 @@ fuzzy_match_recursive(
+ }
+
+ // Recursive call that "skips" this match
+- if (has_mbyte)
+- next_char = str + (*mb_ptr2len)(str);
+- else
+- next_char = str + 1;
++ char_u *next_char = str + (has_mbyte ? (*mb_ptr2len)(str) : 1);
+ if (fuzzy_match_recursive(fuzpat, next_char, strIdx + 1,
+ &recursiveScore, strBegin, strLen, matches,
+ recursiveMatches,
+@@ -4506,8 +4503,8 @@ fuzzy_match_recursive(
+ * Uses char_u for match indices. Therefore patterns are limited to
+ * MAX_FUZZY_MATCHES characters.
+ *
+- * Returns TRUE if 'pat_arg' matches 'str'. Also returns the match score in
+- * 'outScore' and the matching character positions in 'matches'.
++ * Returns TRUE if "pat_arg" matches "str". Also returns the match score in
++ * "outScore" and the matching character positions in "matches".
+ */
+ int
+ fuzzy_match(
+diff --git a/src/testdir/test_matchfuzzy.vim b/src/testdir/test_matchfuzzy.vim
+index 502d136..43eca8f 100644
+--- a/src/testdir/test_matchfuzzy.vim
++++ b/src/testdir/test_matchfuzzy.vim
+@@ -2,6 +2,7 @@
+
+ source shared.vim
+ source check.vim
++source term_util.vim
+
+ " Test for matchfuzzy()
+ func Test_matchfuzzy()
+@@ -253,4 +254,30 @@ func Test_matchfuzzy_limit()
+ call assert_equal([{'id': 5, 'val': 'crayon'}], l->matchfuzzy('c', #{key: 'val', limit: 1}))
+ endfunc
+
++" This was using uninitialized memory
++func Test_matchfuzzy_initialized()
++ CheckRunVimInTerminal
++
++ " This can take a very long time (esp. when using valgrind). Run in a
++ " separate Vim instance and kill it after two seconds. We only check for
++ " memory errors.
++ let lines =<< trim END
++ lvimgrep [ss [fg*
++ END
++ call writefile(lines, 'XTest_matchfuzzy', 'D')
++
++ let buf = RunVimInTerminal('-u NONE -X -Z', {})
++ call term_sendkeys(buf, ":source XTest_matchfuzzy\n")
++ call TermWait(buf, 2000)
++
++ let job = term_getjob(buf)
++ if job_status(job) == "run"
++ call job_stop(job, "int")
++ call TermWait(buf, 50)
++ endif
++
++ " clean up
++ call StopVimInTerminal(buf)
++endfunc
++
+ " vim: shiftwidth=2 sts=2 expandtab
+diff --git a/src/version.c b/src/version.c
+index c93499c..0e83a6f 100644
+--- a/src/version.c
++++ b/src/version.c
+@@ -695,6 +695,8 @@ static char *(features[]) =
+
+ static int included_patches[] =
+ { /* Add new patch number below this line */
++/**/
++ 1499,
+ /**/
+ 1378,
+ /**/
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..6746de8
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,6 @@
+debian/Support-sourcing-a-vimrc.tiny-when-Vim-is-invoked-as-vi.patch
+debian/Detect-the-rst-filetype-using-the-contents-of-the-file.patch
+debian/Add-recognition-of-more-LaTeX-commands-for-tex-filetype-d.patch
+debian/Document-Debian-s-decision-to-disable-modelines-by-defaul.patch
+patch-9.0.1499-using-uninitialized-memory-with-fuzzy-matc.patch
+Fix-GH-267-where-indent-after-a-sub-would-not-work.patch