Commit: patch 9.0.1860: CI: test_crash1() is flaky

2023-09-03 Fir de Conversatie Christian Brabandt
patch 9.0.1860: CI: test_crash1() is flaky

Commit: 
https://github.com/vim/vim/commit/f44cbe96fa44d10d6dd717e0a9f6ef0f104ee98a
Author: Christian Brabandt 
Date:   Mon Sep 4 07:42:27 2023 +0200

patch 9.0.1860: CI: test_crash1() is flaky

Problem:  CI: test_crash1() is flaky
Solution: Wait a bit longer

Signed-off-by: Christian Brabandt 

diff --git a/src/testdir/test_crash.vim b/src/testdir/test_crash.vim
index 8deb79702..b997cc1d2 100644
--- a/src/testdir/test_crash.vim
+++ b/src/testdir/test_crash.vim
@@ -40,7 +40,7 @@ func Test_crash1()
   " clean up
   call delete('Xerr')
   " This test takes a bit longer
-  call TermWait(buf, 200)
+  call TermWait(buf, 500)
 
   let file = 'crash/poc_tagfunc.vim'
   let args = printf(cmn_args, vim, file)
@@ -55,7 +55,6 @@ func Test_crash1()
 \ '  && echo "crash 6: [OK]" >> X_crash1_result.txt' .. "\")
   " clean up
   call delete('X')
-  " This test takes a bit longer
   call TermWait(buf, 200)
 
   " clean up
diff --git a/src/version.c b/src/version.c
index f2ff8d6b7..6ba74438a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+1860,
 /**/
 1859,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qd2OV-00EXrC-TZ%40256bit.org.


Commit: patch 9.0.1859: heap-use-after-free in bt_normal()

2023-09-03 Fir de Conversatie Christian Brabandt
patch 9.0.1859: heap-use-after-free in bt_normal()

Commit: 
https://github.com/vim/vim/commit/6e60cf444a8839ca1694319bf9a82e7b097e5c4d
Author: Christian Brabandt 
Date:   Sun Sep 3 21:43:46 2023 +0200

patch 9.0.1859: heap-use-after-free in bt_normal()

Problem:  heap-use-after-free in bt_normal()
Solution: check that buffer is still valid

Signed-off-by: Christian Brabandt 

diff --git a/src/buffer.c b/src/buffer.c
index 14eac92b9..93f9245f2 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5777,7 +5777,7 @@ bt_normal(buf_T *buf)
 bt_quickfix(buf_T *buf UNUSED)
 {
 #ifdef FEAT_QUICKFIX
-return buf != NULL && buf->b_p_bt[0] == 'q';
+return buf != NULL && buf_valid(buf) && buf->b_p_bt[0] == 'q';
 #else
 return FALSE;
 #endif
diff --git a/src/testdir/crash/bt_quickfix1_poc 
b/src/testdir/crash/bt_quickfix1_poc
new file mode 100644
index 0..97993fde5
--- /dev/null
+++ b/src/testdir/crash/bt_quickfix1_poc
@@ -0,0 +1,5 @@
+au BufReadPre * exe 'sn' .. expand("")
+call writefile([''],'X')
+sil! e X
+call writefile([''],'X')
+sil! e X
diff --git a/src/testdir/test_crash.vim b/src/testdir/test_crash.vim
index 27bf7b55d..8deb79702 100644
--- a/src/testdir/test_crash.vim
+++ b/src/testdir/test_crash.vim
@@ -49,6 +49,15 @@ func Test_crash1()
 
   call TermWait(buf, 100)
 
+  let file = 'crash/bt_quickfix1_poc'
+  let args = printf(cmn_args, vim, file)
+  call term_sendkeys(buf, args ..
+\ '  && echo "crash 6: [OK]" >> X_crash1_result.txt' .. "\")
+  " clean up
+  call delete('X')
+  " This test takes a bit longer
+  call TermWait(buf, 200)
+
   " clean up
   exe buf .. "bw!"
 
@@ -60,6 +69,7 @@ func Test_crash1()
   \ 'crash 3: [OK]',
   \ 'crash 4: [OK]',
   \ 'crash 5: [OK]',
+  \ 'crash 6: [OK]',
   \ ]
 
   call assert_equal(expected, getline(1, '$'))
diff --git a/src/version.c b/src/version.c
index b604b57f8..f2ff8d6b7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+1859,
 /**/
 1858,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qctGM-00DwYZ-Uj%40256bit.org.


Re: Commit: patch 9.0.1857: [security] heap-use-after-free in is_qf_win()

2023-09-03 Fir de Conversatie Christian Brabandt


On So, 03 Sep 2023, Yegappan Lakshmanan wrote:

> On Sun, Sep 3, 2023 at 11:30 AM Christian Brabandt  wrote:
> >
> > patch 9.0.1857: [security] heap-use-after-free in is_qf_win()
> >
> > Commit: 
> > https://github.com/vim/vim/commit/fc68299d436cf87453e432daa77b6d545df4d7ed
> > Author: Christian Brabandt 
> > Date:   Sun Sep 3 20:20:52 2023 +0200
> >
> > patch 9.0.1857: [security] heap-use-after-free in is_qf_win()
> >
> > Problem:  heap-use-after-free in is_qf_win()
> > Solution: Check buffer is valid before accessing it
> >
> > Signed-off-by: Christian Brabandt 
> >
> > diff --git a/src/testdir/crash/bt_quickfix_poc 
> > b/src/testdir/crash/bt_quickfix_poc
> > new file mode 100644
> > index 0..bf02b4dcb
> > --- /dev/null
> > +++ b/src/testdir/crash/bt_quickfix_poc
> > @@ -0,0 +1,9 @@
> > +comman!-narg=* Xexpr lex
> > +auto BufReadPre * exe"sn" ..expand("")
> > +fu Xautocmd_changelist()
> > +cal writefile(['Xtestfile2:4:4'],'Xerr')
> > +  sil! edi Xerr
> > +Xexpr 'Xtestfile:4:4'
> > +endf
> > +call Xautocmd_changelist()
> > +call Xautocmd_changelist()
> > \ No newline at end of file
> >
> 
> Is there supposed to be a newline at the end of this file?

I guess not...


Thanks,
Christian
-- 
I pledge allegiance to the flag
of the United States of America
and to the republic for which it stands,
one nation,
indivisible,
with liberty
and justice for all.
-- Francis Bellamy, 1892

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/ZPTk%2BvjG5LmqI8A0%40256bit.org.


Commit: patch 9.0.1858: [security] heap use after free in ins_compl_get_exp()

2023-09-03 Fir de Conversatie Christian Brabandt
patch 9.0.1858: [security] heap use after free in ins_compl_get_exp()

Commit: 
https://github.com/vim/vim/commit/ee9166eb3b41846661a39b662dc7ebe8b5e15139
Author: Christian Brabandt 
Date:   Sun Sep 3 21:24:33 2023 +0200

patch 9.0.1858: [security] heap use after free in ins_compl_get_exp()

Problem:  heap use after free in ins_compl_get_exp()
Solution: validate buffer before accessing it

Signed-off-by: Christian Brabandt 

diff --git a/src/insexpand.c b/src/insexpand.c
index 3cfdface4..b767b4efd 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -3850,7 +3850,7 @@ ins_compl_get_exp(pos_T *ini)
else
{
// Mark a buffer scanned when it has been scanned completely
-   if (type == 0 || type == CTRL_X_PATH_PATTERNS)
+   if (buf_valid(st.ins_buf) && (type == 0 || type == 
CTRL_X_PATH_PATTERNS))
st.ins_buf->b_scanned = TRUE;
 
compl_started = FALSE;
diff --git a/src/testdir/crash/poc_tagfunc.vim 
b/src/testdir/crash/poc_tagfunc.vim
new file mode 100644
index 0..49d9b6f71
--- /dev/null
+++ b/src/testdir/crash/poc_tagfunc.vim
@@ -0,0 +1,6 @@
+fu Tagfunc(t,f,o)
+  bw
+endf
+set tagfunc=Tagfunc
+n0
+sil0norm0i 
diff --git a/src/testdir/test_crash.vim b/src/testdir/test_crash.vim
index 516d99193..27bf7b55d 100644
--- a/src/testdir/test_crash.vim
+++ b/src/testdir/test_crash.vim
@@ -39,12 +39,17 @@ func Test_crash1()
 \ '  && echo "crash 4: [OK]" >> X_crash1_result.txt' .. "\")
   " clean up
   call delete('Xerr')
-
   " This test takes a bit longer
   call TermWait(buf, 200)
 
+  let file = 'crash/poc_tagfunc.vim'
+  let args = printf(cmn_args, vim, file)
+  call term_sendkeys(buf, args ..
+\ '  || echo "crash 5: [OK]" >> X_crash1_result.txt' .. "\")
+
+  call TermWait(buf, 100)
+
   " clean up
-  call delete('Xerr')
   exe buf .. "bw!"
 
   sp X_crash1_result.txt
@@ -54,6 +59,7 @@ func Test_crash1()
   \ 'crash 2: [OK]',
   \ 'crash 3: [OK]',
   \ 'crash 4: [OK]',
+  \ 'crash 5: [OK]',
   \ ]
 
   call assert_equal(expected, getline(1, '$'))
diff --git a/src/version.c b/src/version.c
index 13d5d695a..b604b57f8 100644
--- a/src/version.c
+++ b/src/version.c
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+1858,
 /**/
 1857,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qcsnL-00DueP-0s%40256bit.org.


Re: Commit: patch 9.0.1857: [security] heap-use-after-free in is_qf_win()

2023-09-03 Fir de Conversatie Yegappan Lakshmanan
Hi Christian,

On Sun, Sep 3, 2023 at 11:30 AM Christian Brabandt  wrote:
>
> patch 9.0.1857: [security] heap-use-after-free in is_qf_win()
>
> Commit: 
> https://github.com/vim/vim/commit/fc68299d436cf87453e432daa77b6d545df4d7ed
> Author: Christian Brabandt 
> Date:   Sun Sep 3 20:20:52 2023 +0200
>
> patch 9.0.1857: [security] heap-use-after-free in is_qf_win()
>
> Problem:  heap-use-after-free in is_qf_win()
> Solution: Check buffer is valid before accessing it
>
> Signed-off-by: Christian Brabandt 
>
> diff --git a/src/testdir/crash/bt_quickfix_poc 
> b/src/testdir/crash/bt_quickfix_poc
> new file mode 100644
> index 0..bf02b4dcb
> --- /dev/null
> +++ b/src/testdir/crash/bt_quickfix_poc
> @@ -0,0 +1,9 @@
> +comman!-narg=* Xexpr lex
> +auto BufReadPre * exe"sn" ..expand("")
> +fu Xautocmd_changelist()
> +cal writefile(['Xtestfile2:4:4'],'Xerr')
> +  sil! edi Xerr
> +Xexpr 'Xtestfile:4:4'
> +endf
> +call Xautocmd_changelist()
> +call Xautocmd_changelist()
> \ No newline at end of file
>

Is there supposed to be a newline at the end of this file?

- Yegappan

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAAW7x7n%3DJxhi6cWecWEPmfA9sNcnQTK6K6Jr2pYYs_MzGZC96A%40mail.gmail.com.


Commit: patch 9.0.1857: [security] heap-use-after-free in is_qf_win()

2023-09-03 Fir de Conversatie Christian Brabandt
patch 9.0.1857: [security] heap-use-after-free in is_qf_win()

Commit: 
https://github.com/vim/vim/commit/fc68299d436cf87453e432daa77b6d545df4d7ed
Author: Christian Brabandt 
Date:   Sun Sep 3 20:20:52 2023 +0200

patch 9.0.1857: [security] heap-use-after-free in is_qf_win()

Problem:  heap-use-after-free in is_qf_win()
Solution: Check buffer is valid before accessing it

Signed-off-by: Christian Brabandt 

diff --git a/src/main.c b/src/main.c
index cca53fe25..a40c3a666 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1646,7 +1646,7 @@ getout(int exitval)
next_tp = tp->tp_next;
FOR_ALL_WINDOWS_IN_TAB(tp, wp)
{
-   if (wp->w_buffer == NULL)
+   if (wp->w_buffer == NULL || !buf_valid(wp->w_buffer))
// Autocmd must have close the buffer already, skip.
continue;
buf = wp->w_buffer;
diff --git a/src/quickfix.c b/src/quickfix.c
index aa431ea10..a3d3e8fb7 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -4492,7 +4492,7 @@ is_qf_win(win_T *win, qf_info_T *qi)
 // set to NULL.
 // A window displaying a location list buffer will have the w_llist_ref
 // pointing to the location list.
-if (bt_quickfix(win->w_buffer))
+if (buf_valid(win->w_buffer) && bt_quickfix(win->w_buffer))
if ((IS_QF_STACK(qi) && win->w_llist_ref == NULL)
|| (IS_LL_STACK(qi) && win->w_llist_ref == qi))
return TRUE;
diff --git a/src/testdir/crash/bt_quickfix_poc 
b/src/testdir/crash/bt_quickfix_poc
new file mode 100644
index 0..bf02b4dcb
--- /dev/null
+++ b/src/testdir/crash/bt_quickfix_poc
@@ -0,0 +1,9 @@
+comman!-narg=* Xexpr lex
+auto BufReadPre * exe"sn" ..expand("") 
+fu Xautocmd_changelist()
+cal writefile(['Xtestfile2:4:4'],'Xerr')
+  sil! edi Xerr
+Xexpr 'Xtestfile:4:4'
+endf
+call Xautocmd_changelist()
+call Xautocmd_changelist()
\ No newline at end of file
diff --git a/src/testdir/test_crash.vim b/src/testdir/test_crash.vim
index eb3c0a37f..516d99193 100644
--- a/src/testdir/test_crash.vim
+++ b/src/testdir/test_crash.vim
@@ -5,38 +5,58 @@ source screendump.vim
 CheckScreendump
 
 func Test_crash1()
+  if !executable('sh')
+throw 'Skipped: sh not executable!'
+  endif
   " The following used to crash Vim
-  " let opts = #{wait_for_ruler: 0, rows: 20, cmd: 'sh'}
   let opts = #{cmd: 'sh'}
-  let args = 'bash'
   let vim  = GetVimProg()
 
-  let buf = RunVimInTerminal(args, opts)
+  let buf = RunVimInTerminal('sh', opts)
 
   let file = 'crash/poc_huaf1'
   let cmn_args = "%s -u NONE -i NONE -n -e -s -S %s -c ':qa!'"
   let args = printf(cmn_args, vim, file)
   call term_sendkeys(buf, args ..
-\ '  && echo "crash 1: [OK]" >> X_crash1_result.txt' .. "\")
+\ '  && echo "crash 1: [OK]" > X_crash1_result.txt' .. "\")
+  call TermWait(buf, 50)
 
   let file = 'crash/poc_huaf2'
   let args = printf(cmn_args, vim, file)
   call term_sendkeys(buf, args ..
 \ '  && echo "crash 2: [OK]" >> X_crash1_result.txt' .. "\")
+  call TermWait(buf, 50)
 
   let file = 'crash/poc_huaf3'
   let args = printf(cmn_args, vim, file)
   call term_sendkeys(buf, args ..
 \ '  && echo "crash 3: [OK]" >> X_crash1_result.txt' .. "\")
+  call TermWait(buf, 100)
 
-  call TermWait(buf, 50)
+  let file = 'crash/bt_quickfix_poc'
+  let args = printf(cmn_args, vim, file)
+  call term_sendkeys(buf, args ..
+\ '  && echo "crash 4: [OK]" >> X_crash1_result.txt' .. "\")
+  " clean up
+  call delete('Xerr')
+
+  " This test takes a bit longer
+  call TermWait(buf, 200)
 
   " clean up
+  call delete('Xerr')
   exe buf .. "bw!"
 
   sp X_crash1_result.txt
-  call assert_equal(['crash 1: [OK]', 'crash 2: [OK]', 'crash 3: [OK]'],
-\ getline(1, '$'))
+
+  let expected = [
+  \ 'crash 1: [OK]',
+  \ 'crash 2: [OK]',
+  \ 'crash 3: [OK]',
+  \ 'crash 4: [OK]',
+  \ ]
+
+  call assert_equal(expected, getline(1, '$'))
   bw!
 
   call delete('X_crash1_result.txt')
diff --git a/src/version.c b/src/version.c
index 98964fbbd..13d5d695a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+1857,
 /**/
 1856,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qcrrG-00Dqq7-Px%40256bit.org.


Re: syntax keywords with '[' character

2023-09-03 Fir de Conversatie Doug Kearns
G'day Ron,

On Sun, 3 Sept 2023 at 22:33, Ron Aaron  wrote:

> I was just given a bug report for a new version of my syntax file, and
> the problem is that a syntax keyword with a lone '[' doesn't work (it
> causes an error  message  E789)
>
> I have 'syn iskeyword 33-255' (because everything except a space is a
> valid keyword identifier) but the syntax parser in vim doesn't like it.
>
> I have other keywords with [ but they pair with a ], and my guess is that
> these are being (improperly) treated as character classes.
>
> How can I get a keyword like SQL[ to be recognized?
>

I don't believe you can.  We ran into the same issue with the Forth syntax
file and just use syn-match for words that include '['.

The [...] matches an optional sequence like %[..] in a pattern.  There's
actually a help entry for E789.

It could be changed to respect the 'isk' value(s) over the optional
sequence but I'm not sure one is better than the other.  It's not
inconceivable that the pattern might be heavily used even though '[' is
included in 'isk' for a small number of keywords.

Regards,
Doug

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAJ1uvoBo9q6iYQYJeKQv%2B80KmudZq1qXj6FZ%3D0%2BbaDUbnsm56g%40mail.gmail.com.


Commit: patch 9.0.1856: issues with formatting positional arguments

2023-09-03 Fir de Conversatie Christian Brabandt
patch 9.0.1856: issues with formatting positional arguments

Commit: 
https://github.com/vim/vim/commit/aa90d4f031f73a34aaef5746931ea746849a2231
Author: Christ van Willegen 
Date:   Sun Sep 3 17:22:37 2023 +0200

patch 9.0.1856: issues with formatting positional arguments

Problem:  issues with formatting positional arguments
Solution: fix them, add tests and documentation

closes: #12140
closes: #12985

Signed-off-by: Christian Brabandt 
Co-authored-by: Christ van Willegen 
Tentatively fix message_test. Check NULL ptr.

diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 507347d97..ef99ca60a 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -6707,8 +6707,13 @@ printf({fmt}, {expr1} ...)   
*printf()*
a conversion is wider than the field width, the field
is expanded to contain the conversion result.
The 'h' modifier indicates the argument is 16 bits.
-   The 'l' modifier indicates the argument is 32 bits.
-   The 'L' modifier indicates the argument is 64 bits.
+   The 'l' modifier indicates the argument is a long
+   integer.  The size will be 32 bits or 64 bits
+   depending on your platform.
+   The "ll" modifier indicates the argument is 64 bits.
+   The b and B conversion specifiers never take a width
+   modifier and always assume their argument is a 64 bit
+   integer.
Generally, these modifiers are not useful. They are
ignored when type is known from the argument.
 
diff --git a/src/errors.h b/src/errors.h
index 166204399..1dfb9ab8f 100644
--- a/src/errors.h
+++ b/src/errors.h
@@ -3511,5 +3511,7 @@ EXTERN char 
e_member_str_type_mismatch_expected_str_but_got_str[]
INIT(= N_("E1406: Member \"%s\": type mismatch, expected %s but got 
%s"));
 EXTERN char e_method_str_type_mismatch_expected_str_but_got_str[]
INIT(= N_("E1407: Member \"%s\": type mismatch, expected %s but got 
%s"));
+EXTERN char e_aptypes_is_null_str_nr[]
+   INIT(= "E1408: Internal error: ap_types or ap_types[idx] is NULL: %d: 
%s");
 
 // E1371 - E1399 unused
diff --git a/src/message_test.c b/src/message_test.c
index e5fd56230..4d5288937 100644
--- a/src/message_test.c
+++ b/src/message_test.c
@@ -40,6 +40,7 @@ char *fmt_012p = "%012p";
 char *fmt_5S   = "%5S";
 char *fmt_06b  = "%06b";
 char *fmt_06pb = "%1$0.*2$b";
+char *fmt_06pb2 = "%2$0*1$b";
 char *fmt_212s = "%2$s %1$s %2$s";
 char *fmt_21s  = "%2$s %1$s";
 
@@ -442,6 +443,11 @@ test_vim_snprintf_positional(void)
assert(bsize == 0 || STRNCMP(buf, "deadbeef", bsize_int) == 0);
assert(bsize == 0 || buf[MIN(n, bsize_int)] == '
 
+   n = vim_snprintf(buf, bsize, fmt_06pb2, 6, (uvarnumber_T)12);
+   assert(n == 6);
+   assert(bsize == 0 || STRNCMP(buf, "001100", bsize_int) == 0);
+   assert(bsize == 0 || buf[MIN(n, bsize_int)] == '
+
n = vim_snprintf(buf, bsize, fmt_06pb, (uvarnumber_T)12, 6);
assert(n == 6);
assert(bsize == 0 || STRNCMP(buf, "001100", bsize_int) == 0);
diff --git a/src/strings.c b/src/strings.c
index d1d82f482..cb044ec17 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -2251,8 +2251,7 @@ enum
  */
 static int
 format_typeof(
-const char *type,
-intusetvs UNUSED)
+const char *type)
 {
 // allowed values: 
 charlength_modifier = '
@@ -2285,18 +2284,6 @@ format_typeof(
default: break;
 }
 
-# if defined(FEAT_EVAL)
-if (usetvs)
-{
-   switch (fmt_spec)
-   {
-   case 'd': case 'u': case 'o': case 'x': case 'X':
-   if (length_modifier == '
-   length_modifier = 'L';
-   }
-}
-# endif
-
 // get parameter value, do initial processing
 switch (fmt_spec)
 {
@@ -2330,7 +2317,7 @@ format_typeof(
if (fmt_spec == 'p')
return TYPE_POINTER;
else if (fmt_spec == 'b' || fmt_spec == 'B')
-   return TYPE_UNSIGNEDINT;
+   return TYPE_UNSIGNEDLONGLONGINT;
else if (fmt_spec == 'd')
{
// signed
@@ -2379,7 +2366,7 @@ format_typeof(
 format_typename(
 const char  *type)
 {
-switch (format_typeof(type, FALSE))
+switch (format_typeof(type))
 {
case TYPE_INT:
return _(typename_int);
@@ -2467,7 +2454,7 @@ adjust_types(
}
else
{
-   if (format_typeof(type, FALSE) != format_typeof((*ap_types)[arg - 
1], FALSE))
+   if (format_typeof(type) != format_typeof((*ap_types)[arg - 1]))
{
semsg(_( e_positional_arg_num_type_inconsistent_str_str), arg, 
format_typename(type), 

Commit: patch 9.0.1855: mode() doesn't indicate command line for terminal

2023-09-03 Fir de Conversatie Christian Brabandt
patch 9.0.1855: mode() doesn't indicate command line for terminal

Commit: 
https://github.com/vim/vim/commit/71ebf3bacaa22c841d9a8cb050c52fb21ac0970a
Author: h-east 
Date:   Sun Sep 3 17:12:55 2023 +0200

patch 9.0.1855: mode() doesn't indicate command line for terminal

Problem:  mode() doesn't indicate command line for terminal
Solution: make it return 'ct' for command-line from Terminal mode

closes: #6265
closes: #13017
closes: #13018

Signed-off-by: Christian Brabandt 
Co-authored-by: h-east 

diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 236454793..507347d97 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -6408,6 +6408,7 @@ mode([expr])  Return a string that indicates the 
current mode.
   Rvc  Virtual Replace mode completion |compl-generic|
   Rvx  Virtual Replace mode |i_CTRL-X| completion
   cCommand-line editing
+  ct   Command-line editing via Terminal-Job mode
   cv   Vim Ex mode |gQ|
   ce   Normal Ex mode |Q|
   rHit-enter prompt
diff --git a/src/misc1.c b/src/misc1.c
index 72083504a..5b008c614 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -664,7 +664,11 @@ get_mode(char_u *buf)
 }
 #ifdef FEAT_TERMINAL
 else if (term_use_loop())
+{
+   if (State & MODE_CMDLINE)
+   buf[i++] = 'c';
buf[i++] = 't';
+}
 #endif
 else if (VIsual_active)
 {
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index ab1dbf3b5..654d9125b 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -935,9 +935,19 @@ func Test_mode()
 
   if has('terminal')
 term
+" Terminal-Job mode
+call assert_equal('t', mode())
+call assert_equal('t', mode(1))
+call feedkeys("\:echo \=Save_mode()\\", 'xt')
+call assert_equal("c-ct", g:current_modes)
+call feedkeys("\", 'xt')
+
+" Terminal-Normal mode
 call feedkeys("\N", 'xt')
 call assert_equal('n', mode())
 call assert_equal('nt', mode(1))
+call feedkeys(":echo \=Save_mode()\\", 'xt')
+call assert_equal("c-c", g:current_modes)
 call feedkeys("aexit\", 'xt')
   endif
 
diff --git a/src/version.c b/src/version.c
index c1f72ff9d..a07a2bf15 100644
--- a/src/version.c
+++ b/src/version.c
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+1855,
 /**/
 1854,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qcp35-00Dfdo-3J%40256bit.org.


Re: syntax keywords with '[' character

2023-09-03 Fir de Conversatie Ron Aaron
Thank you; I didn't know that about the 'optional tail'. So my 'fix' 
actually means that both SQL and SQL[ will be recognized as keywords, which 
isn't what's wanted.

The user who pointed out the issue is actually using 'neovim', so it would 
be great (for me) if a solution which worked with the existing code were 
possible.
On Sunday, September 3, 2023 at 5:03:22 PM UTC+3 James McCoy wrote:

> On Sun, Sep 03, 2023 at 05:33:22AM -0700, Ron Aaron wrote:
> > I was just given a bug report for a new version of my syntax file, and  
> the
> > problem is that a syntax keyword with a lone '[' doesn't work (it causes 
> an
> > error  message  E789)
>
> See ":help E789":
>
> < *E789* *E890*
> When you have a keyword with an optional tail, like Ex commands in
> Vim, you can put the optional characters inside [], to define all the
> variations at once: >
> :syntax keyword vimCommand ab[breviate] n[ext]
>
> So it seems like there needs to be a mechanism to opt out of this
> syntax for your case.
>
> Cheers,
> -- 
> James
> GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7 2D23 DFE6 91AE 331B A3DB
>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/a3ba00c7-ce30-4d1d-88a6-33be6fb0fd37n%40googlegroups.com.


Re: syntax keywords with '[' character

2023-09-03 Fir de Conversatie James McCoy
On Sun, Sep 03, 2023 at 05:33:22AM -0700, Ron Aaron wrote:
> I was just given a bug report for a new version of my syntax file, and  the
> problem is that a syntax keyword with a lone '[' doesn't work (it causes an
> error  message  E789)

See ":help E789":

<   *E789* *E890*
When you have a keyword with an optional tail, like Ex commands in
Vim, you can put the optional characters inside [], to define all the
variations at once: >
  :syntax keyword   vimCommand   ab[breviate] n[ext]

So it seems like there needs to be a mechanism to opt out of this
syntax for your case.

Cheers,
-- 
James
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230903140315.aq7x7obwekmbgb7z%40localhost.


Re: syntax keywords with '[' character

2023-09-03 Fir de Conversatie Ron Aaron
Hmm. This works:SQL[[]
However, a keyword like exec[] if I try exec[[]] complains about the 
trailing ]  

I would have expected syntax keywords to be matched "as is" and not like 
regexes. 
On Sunday, September 3, 2023 at 3:33:22 PM UTC+3 Ron Aaron wrote:

> I was just given a bug report for a new version of my syntax file, and  
> the problem is that a syntax keyword with a lone '[' doesn't work (it 
> causes an error  message  E789)
>
> I have 'syn iskeyword 33-255' (because everything except a space is a 
> valid keyword identifier) but the syntax parser in vim doesn't like it.
>
> I have other keywords with [ but they pair with a ], and my guess is that 
> these are being (improperly) treated as character classes.
>
> How can I get a keyword like SQL[ to be recognized?
>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/99c10018-f2a2-4d1c-b212-bbc68e66abfen%40googlegroups.com.


syntax keywords with '[' character

2023-09-03 Fir de Conversatie Ron Aaron
I was just given a bug report for a new version of my syntax file, and  the 
problem is that a syntax keyword with a lone '[' doesn't work (it causes an 
error  message  E789)

I have 'syn iskeyword 33-255' (because everything except a space is a valid 
keyword identifier) but the syntax parser in vim doesn't like it.

I have other keywords with [ but they pair with a ], and my guess is that 
these are being (improperly) treated as character classes.

How can I get a keyword like SQL[ to be recognized?

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/9e443f03-90ab-4511-95e4-f3341d99c1b3n%40googlegroups.com.


Commit: patch 9.0.1854: test_crash1() fails on CI

2023-09-03 Fir de Conversatie Christian Brabandt
patch 9.0.1854: test_crash1() fails on CI

Commit: 
https://github.com/vim/vim/commit/db510ca8052884fd260f425025bacf44f6c92fa9
Author: Christian Brabandt 
Date:   Sun Sep 3 09:23:12 2023 +0200

patch 9.0.1854: test_crash1() fails on CI

Problem:  test_crash1() fails on CI
Solution: don't run Screendump test, verify that it doesn't crash
  by running it through a shell command line, testing
  the exit value and concatenating success cmd using '&&'

Signed-off-by: Christian Brabandt 

diff --git a/src/testdir/test_crash.vim b/src/testdir/test_crash.vim
index 445fe8d5a..eb3c0a37f 100644
--- a/src/testdir/test_crash.vim
+++ b/src/testdir/test_crash.vim
@@ -6,20 +6,40 @@ CheckScreendump
 
 func Test_crash1()
   " The following used to crash Vim
-  let opts = #{wait_for_ruler: 0, rows: 20}
-  let args = ' -u NONE -i NONE -n -e -s -S '
-  let buf = RunVimInTerminal(args .. ' crash/poc_huaf1', opts)
-  call VerifyScreenDump(buf, 'Test_crash_01', {})
-  exe buf .. "bw!"
+  " let opts = #{wait_for_ruler: 0, rows: 20, cmd: 'sh'}
+  let opts = #{cmd: 'sh'}
+  let args = 'bash'
+  let vim  = GetVimProg()
 
-  let buf = RunVimInTerminal(args .. ' crash/poc_huaf2', opts)
-  call VerifyScreenDump(buf, 'Test_crash_01', {})
-  exe buf .. "bw!"
+  let buf = RunVimInTerminal(args, opts)
 
-  let buf = RunVimInTerminal(args .. ' crash/poc_huaf3', opts)
-  call VerifyScreenDump(buf, 'Test_crash_01', {})
+  let file = 'crash/poc_huaf1'
+  let cmn_args = "%s -u NONE -i NONE -n -e -s -S %s -c ':qa!'"
+  let args = printf(cmn_args, vim, file)
+  call term_sendkeys(buf, args ..
+\ '  && echo "crash 1: [OK]" >> X_crash1_result.txt' .. "\")
+
+  let file = 'crash/poc_huaf2'
+  let args = printf(cmn_args, vim, file)
+  call term_sendkeys(buf, args ..
+\ '  && echo "crash 2: [OK]" >> X_crash1_result.txt' .. "\")
+
+  let file = 'crash/poc_huaf3'
+  let args = printf(cmn_args, vim, file)
+  call term_sendkeys(buf, args ..
+\ '  && echo "crash 3: [OK]" >> X_crash1_result.txt' .. "\")
+
+  call TermWait(buf, 50)
+
+  " clean up
   exe buf .. "bw!"
 
+  sp X_crash1_result.txt
+  call assert_equal(['crash 1: [OK]', 'crash 2: [OK]', 'crash 3: [OK]'],
+\ getline(1, '$'))
+  bw!
+
+  call delete('X_crash1_result.txt')
 endfunc
 
 func Test_crash2()
diff --git a/src/version.c b/src/version.c
index fe1495ab6..c1f72ff9d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+1854,
 /**/
 1853,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qchn7-00DCyv-BV%40256bit.org.


Re: Typo(s) in channel.txt

2023-09-03 Fir de Conversatie Christian Brabandt


On So, 03 Sep 2023, Adri Verhoef wrote:

> Originally, I reported this back in 2018.  Since then, the documentation for
> job_start() moved from eval.txt to channel.txt and the text that I'm
> describing is still there.
> 
> In the documentation for job_start() it shows:
> 
>   On MS-Windows, job_start() makes a GUI application hidden. If
>   want to show it, Use |:!start| instead.
> 
> Perhaps the last line should read:
> 
>   you want to show it, use |:!start| instead.
> 
> [inserting the word 'you' and changing 'Use' into 'use']

I think you reported that already and I have fixed it as part of the 
runtime file PR that is still pending: 
https://github.com/vim/vim/pull/12790/commits/796a3e87b064bcecde6e1c3871b75ec2862fb831

Thanks,
Christian
-- 
You are deeply attached to your friends and acquaintances.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/ZPQ2unmb6dFVBSzG%40256bit.org.


Re: New test problem: test_crash.vim: Found errors in Test_crash1():

2023-09-03 Fir de Conversatie Christian Brabandt


On Sa, 02 Sep 2023, Ernie Rael wrote:

> New problem? Or is it just me?

No I noticed it too. It was my attempt to ensure the security fixes are 
correctly tested and do no longer crash vim. But it seems Screendump 
tests do not work well for that. I have a different test now, will be 
pushing in a few minutes. 

Thanks,
Christian
-- 
I once decorated my apartment entirely in ten foot salad forks!!

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/ZPQz%2BLUId7WmnBne%40256bit.org.