Re: Patch 8.0.1656
Christian Brabandt wrote: > On Di, 03 Apr 2018, Christian Brabandt wrote: > > > > > On Di, 03 Apr 2018, Bram Moolenaar wrote: > > > > > And we should have a test for xxd some day. > > > > I'll have a look. > > How about the following basic test? Thanks! It might be good to check if xxd was actually built. The normal "make" command should, but some people might use their own way of building. A missing "xxd" executable should not make the test fail. -- In a world without walls and borders, who needs windows and gates? /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org/// -- -- 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. For more options, visit https://groups.google.com/d/optout.
Re: Patch 8.0.1656
On Fr, 06 Apr 2018, Bram Moolenaar wrote: > It might be good to check if xxd was actually built. The normal "make" > command should, but some people might use their own way of building. > A missing "xxd" executable should not make the test fail. Yeah, initially, I wanted to make the test depend on src/xxd/xxd But I couldn't figure out how to make it depend on a rule from a different Makefile, so I left it as is. So here is an update that simply checks if $XXD is executable. Best, Christian -- Die größten Ereignisse, das sind nicht unsere lautesten, sondern unsere stillsten Stunden. -- Friedrich Wilhelm Nietzsche -- -- 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. For more options, visit https://groups.google.com/d/optout. From a5cda5454aa8cd297249f75dcb880e8882dba53e Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 5 Apr 2018 23:26:03 +0200 Subject: [PATCH] Add a test for xxd --- src/testdir/Make_all.mak | 1 + src/testdir/Makefile | 4 ++ src/testdir/test_xxd.vim | 95 3 files changed, 100 insertions(+) create mode 100644 src/testdir/test_xxd.vim diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 159bf1ece..b4e4bc328 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -187,6 +187,7 @@ NEW_TESTS = test_arabic.res \ test_windows_home.res \ test_wordcount.res \ test_writefile.res \ + test_xxd.res \ test_alot_latin.res \ test_alot_utf8.res \ test_alot.res diff --git a/src/testdir/Makefile b/src/testdir/Makefile index 2ff72c230..fe36a4e05 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -4,6 +4,7 @@ # Use console or GUI. VIMPROG = ../vim +XXDPROG = ../xxd/xxd # VIMPROG = ../gvim SCRIPTSOURCE = ../../runtime @@ -145,3 +146,6 @@ test_gui_init.res: test_gui_init.vim opt_test.vim: ../option.c gen_opt_test.vim $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../option.c + +test_xxd.res: + XXD=$(XXDPROG); export XXD; $(RUN_VIMTEST) $(NO_INITS) -S runtest.vim test_xxd.vim diff --git a/src/testdir/test_xxd.vim b/src/testdir/test_xxd.vim new file mode 100644 index 0..c0ed06ae8 --- /dev/null +++ b/src/testdir/test_xxd.vim @@ -0,0 +1,95 @@ +" Test for the xxd command +func! PrepareBuffer(command) + %d + call append(0, a:command) + $d + w Xfile +endfunc + +func! s:Mess(counter) + return printf("Failed xxd test %d:", a:counter) +endfunc + +func! Test_xxd() + if empty($XXD) || !executable($XXD) +return + endif + new + let s:test=0 + call PrepareBuffer(range(1,30)) + " Test 1: simple, filter the result through xxd + let s:test+=1 + let msg=printf("Failed xxd test %d:", s:test) + %!$XXD % + let expected=[ +\ ': 310a 320a 330a 340a 350a 360a 370a 380a 1.2.3.4.5.6.7.8.', +\ '0010: 390a 3130 0a31 310a 3132 0a31 330a 3134 9.10.11.12.13.14', +\ '0020: 0a31 350a 3136 0a31 370a 3138 0a31 390a .15.16.17.18.19.', +\ '0030: 3230 0a32 310a 3232 0a32 330a 3234 0a32 20.21.22.23.24.2', +\ '0040: 350a 3236 0a32 370a 3238 0a32 390a 3330 5.26.27.28.29.30', +\ '0050: 0a .'] + call assert_equal(expected, getline(1,'$'), msg) + " Test 2: reverse the result + let s:test+=1 + %!$XXD -r + call assert_equal(map(range(1,30), {v,c -> string(c)}), getline(1,'$'), s:Mess(s:test)) + + " Test 3: Skip the first 30 bytes + let s:test+=1 + %!$XXD -s 0x30 % + call assert_equal(expected[3:], getline(1,'$'), s:Mess(s:test)) + + " Test 4: Skip the first 30 bytes + let s:test+=1 + %!$XXD -s -0x31 % + call assert_equal(expected[2:], getline(1,'$'), s:Mess(s:test)) + + " Test 5: Print 120 bytes as continuous hexdump with 20 octets per line + let s:test+=1 + %d + 0r! $XXD -l 120 -ps -c 20 ../../runtime/doc/xxd.1 + $d + let expected=[ + \ '2e54482058584420312022417567757374203139', + \ '39362220224d616e75616c207061676520666f72', + \ '20787864220a2e5c220a2e5c222032317374204d', + \ '617920313939360a2e5c22204d616e2070616765', + \ '20617574686f723a0a2e5c2220202020546f6e79', + \ '204e7567656e74203c746f6e79407363746e7567'] + call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) + " Test 6: Print the date from xxd.1 + let s:test+=1 + %d + 0r! $XXD -s 0x36 -l 13 -c 13 ../../runtime/doc/xxd.1 + $d + call assert_equal('0036: 3231 7374 204d 6179 2031 3939 36 21st May 1996', getline(1), s:Mess(s:test)) + " Test 7: Print C include + let s:test+=1 + call writefile(['TESTabcd09'], 'Xfile') + %d + 0r
Re: vim prompt E484: Can't open file
On Do, 05 Apr 2018, brucekan...@gmail.com wrote: > 在 2018年4月3日星期二 UTC+8下午6:35:57,Christian Brabandt写道: > > On Di, 03 Apr 2018, brucekan...@gmail.com wrote: > > > > > I'm using VIM 8.0 and set the option: "set > > > cscopequickfix=s-,c-,d-,i-,t-,e-" > > > vim will prompt "E484: Can't open file /tmp/vx/n" occasionally if I'm > > > not root user. > > > > > > when set above option, vim will generate a temp directory under /tmp, I > > > found the temp direcoty was deleted every time when the fault was > > > occurred. > > > > > > after checking source code, the suspecious place is in function: > > > vim_tempname > > > > > > if (vim_tempdir != NULL) > > > { > > > /* There is no need to check if the file exists, because we own the > > > * directory and nobody else creates a file in it. */ > > > sprintf((char *)itmp, "%s%ld", vim_tempdir, temp_count++); > > > return vim_strsave(itmp); > > > } > > > > > > if the vim_tempdir is deleted by unknown operation/process, then vim will > > > fault due to it not checking this temp directory before writing it, maybe > > > we need to check vim_tempdir here, if it's not accessable, we build > > > another temp directory. > > > > Do you have any tmp cleanup packages installed that may remove such > > things? Try to disable it. > > > > I have proposed a similar patch several years ago, but it was found to > > work around the real problem that /tmp should not be cleaned randomly, > > so it wasn't included. > > > > > > Best, > > Christian > > -- > > Wußten Sie schon... > > ... daß der Walfisch, das größte lebende Säugetier, alle anderen > > Säugetiere an Größe übertrifft? > > Hi Christian, > Thanks for you response, I haven't deep investigated which process/operation > delete that temp directory(this fault only appear when I am a normal user, > when I am root, everything is ok), there is another scenario: vim user may > use vim on a shared server, they can't disable cleanup process run in > background or prevent other user delete that temp diretory, so they can't > guarantee that temp direcoty is always there, my opinion is vim should not > depend it's stability on external environment especially public directory, > there may happen something out of vim user's control. True, but some people believe that the system is broken, if it silently deletes directories below /tmp. After all, that's what /tmp is for. It may only be deleted on reboot. Best, Christian -- Was wir der Natur antun, tun wir uns selbst an. -- Sprichwort der Mapuche-Indianer (Chile) -- -- 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. For more options, visit https://groups.google.com/d/optout.
Patch 8.0.1667
Patch 8.0.1667 Problem:Terminal window tests are flaky. Solution: Increase the waiting time for Vim to start. Files: src/testdir/screendump.vim *** ../vim-8.0.1666/src/testdir/screendump.vim 2018-03-29 17:40:42.607415702 +0200 --- src/testdir/screendump.vim 2018-04-06 20:17:04.233652369 +0200 *** *** 59,66 let buf = term_start(cmd, {'curwin': 1, 'term_rows': rows, 'term_cols': cols}) call assert_equal([rows, cols], term_getsize(buf)) ! " Wait for the ruler (in the status line) to be shown. ! call WaitFor({-> len(term_getline(buf, rows)) >= cols - 1}) return buf endfunc --- 59,67 let buf = term_start(cmd, {'curwin': 1, 'term_rows': rows, 'term_cols': cols}) call assert_equal([rows, cols], term_getsize(buf)) ! " Wait for "All" of the ruler in the status line to be shown. ! " This can be quite slow (e.g. when using valgrind), wait up to 4 seconds. ! call WaitFor({-> len(term_getline(buf, rows)) >= cols - 1}, 4000) return buf endfunc *** ../vim-8.0.1666/src/version.c 2018-04-05 22:59:47.278555923 +0200 --- src/version.c 2018-04-06 20:21:27.195796852 +0200 *** *** 764,765 --- 764,767 { /* Add new patch number below this line */ + /**/ + 1667, /**/ -- hundred-and-one symptoms of being an internet addict: 111. You and your friends get together regularly on IRC, even though all of you live in the same city. /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org/// -- -- 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. For more options, visit https://groups.google.com/d/optout.
Patch 8.0.1668
Patch 8.0.1668 Problem:Terminal debugger: can't re-open source code window. Solution: Add the :Source command. Also create the window if needed when gdb stops at a source line. Files: runtime/pack/dist/opt/termdebug/plugin/termdebug.vim, runtime/doc/terminal.txt *** ../vim-8.0.1667/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim 2018-03-29 18:29:47.297127408 +0200 --- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim2018-04-06 22:17:33.335916792 +0200 *** *** 246,251 --- 246,252 command -range -nargs=* Evaluate call s:Evaluate(, ) command Gdb call win_gotoid(s:gdbwin) command Program call win_gotoid(s:ptywin) + command Source call s:GotoStartwinOrCreateIt() command Winbar call s:InstallWinbar() " TODO: can the K mapping be restored? *** *** 269,281 " Install the window toolbar in the current window. func s:InstallWinbar() ! nnoremenu WinBar.Step :Step ! nnoremenu WinBar.Next :Over ! nnoremenu WinBar.Finish :Finish ! nnoremenu WinBar.Cont :Continue ! nnoremenu WinBar.Stop :Stop ! nnoremenu WinBar.Eval :Evaluate ! call add(s:winbar_winids, win_getid(winnr())) endfunc " Delete installed debugger commands in the current window. --- 270,284 " Install the window toolbar in the current window. func s:InstallWinbar() ! if has('menu') && &mouse != '' ! nnoremenu WinBar.Step :Step ! nnoremenu WinBar.Next :Over ! nnoremenu WinBar.Finish :Finish ! nnoremenu WinBar.Cont :Continue ! nnoremenu WinBar.Stop :Stop ! nnoremenu WinBar.Eval :Evaluate ! call add(s:winbar_winids, win_getid(winnr())) ! endif endfunc " Delete installed debugger commands in the current window. *** *** 450,455 --- 453,466 echoerr substitute(a:msg, '.*msg="\(.*\)"', '\1', '') endfunc + func s:GotoStartwinOrCreateIt() + if !win_gotoid(s:startwin) + new + let s:startwin = win_getid(winnr()) + call s:InstallWinbar() + endif + endfunc + " Handle stopping and running message from gdb. " Will update the sign that shows the current position. func s:HandleCursor(msg) *** *** 461,491 let s:stopped = 0 endif ! if win_gotoid(s:startwin) ! let fname = substitute(a:msg, '.*fullname="\([^"]*\)".*', '\1', '') ! if a:msg =~ '^\(\*stopped\|=thread-selected\)' && filereadable(fname) ! let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '') ! if lnum =~ '^[0-9]*$' ! if expand('%:p') != fnamemodify(fname, ':p') ! if &modified ! " TODO: find existing window ! exe 'split ' . fnameescape(fname) ! let s:startwin = win_getid(winnr()) ! else ! exe 'edit ' . fnameescape(fname) ! endif endif - exe lnum - exe 'sign unplace ' . s:pc_id - exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . fname - setlocal signcolumn=yes endif ! else exe 'sign unplace ' . s:pc_id endif ! ! call win_gotoid(wid) endif endfunc " Handle setting a breakpoint --- 472,503 let s:stopped = 0 endif ! call s:GotoStartwinOrCreateIt() ! ! let fname = substitute(a:msg, '.*fullname="\([^"]*\)".*', '\1', '') ! if a:msg =~ '^\(\*stopped\|=thread-selected\)' && filereadable(fname) ! let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '') ! if lnum =~ '^[0-9]*$' ! if expand('%:p') != fnamemodify(fname, ':p') ! if &modified ! " TODO: find existing window ! exe 'split ' . fnameescape(fname) ! let s:startwin = win_getid(winnr()) ! call s:InstallWinbar() ! else ! exe 'edit ' . fnameescape(fname) endif endif ! exe lnum exe 'sign unplace ' . s:pc_id + exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . fname + setlocal signcolumn=yes endif ! else ! exe 'sign unplace ' . s:pc_id endif + + call win_gotoid(wid) endfunc " Handle setting a breakpoint *** ../vim-8.0.1667/runtime/doc/terminal.txt2018-04-05 22:59:37.198608805 +0200 --- runtime/doc/terminal.txt2018-04-06 22:22:04.258510491 +0200 *** *** 731,736 --- 731,741 You can add the window toolbar in other windows you open with: > :Winbar + If gdb stops at a source line and there is no window currently showing the + source code, a new window will be created for the source code. This also + happens if the buffer in the source code window has been modified and can't be + abandoned. + Inspecting variables ~ *termdebug-variables* *** *** 745,752 Other commands ~ *termdebug-commands* ! :Gdbjump to the gdb window !
Patch 8.0.1669
Patch 8.0.1669 Problem::vimgrep may add entries to the wrong quickfix list. Solution: Use the list identifier. (Yegappan Lakshmanan) Files: src/quickfix.c, src/testdir/test_quickfix.vim *** ../vim-8.0.1668/src/quickfix.c 2018-03-24 14:01:52.319933545 +0100 --- src/quickfix.c 2018-04-06 22:53:14.463745531 +0200 *** *** 4160,4165 --- 4160,4180 } /* + * Return the quickfix/location list number with the given identifier. + * Returns -1 if list is not found. + */ + static int + qf_id2nr(qf_info_T *qi, int_u qfid) + { + int qf_idx; + + for (qf_idx = 0; qf_idx < qi->qf_listcount; qf_idx++) + if (qi->qf_lists[qf_idx].qf_id == qfid) + return qf_idx; + return -1; + } + + /* * Return the vimgrep autocmd name. */ static char_u * *** *** 4272,4311 */ static int vgr_qflist_valid( qf_info_T *qi, ! int_u save_qfid, ! qfline_T*cur_qf_start, ! int loclist_cmd, char_u *title) { ! if (loclist_cmd) { ! /* !* Verify that the location list is still valid. An autocmd might !* have freed the location list. !*/ ! if (!qflist_valid(curwin, save_qfid)) { EMSG(_(e_loc_list_changed)); return FALSE; } } - if (cur_qf_start != qi->qf_lists[qi->qf_curlist].qf_start) - { - int idx; /* Autocommands changed the quickfix list. Find the one we were * using and restore it. */ ! for (idx = 0; idx < LISTCOUNT; ++idx) ! if (cur_qf_start == qi->qf_lists[idx].qf_start) ! { ! qi->qf_curlist = idx; ! break; ! } ! if (idx == LISTCOUNT) ! /* List cannot be found, create a new one. */ ! qf_new_list(qi, title); ! } return TRUE; } --- 4287,4318 */ static int vgr_qflist_valid( + win_T *wp, qf_info_T *qi, ! int_u qfid, char_u *title) { ! /* Verify that the quickfix/location list was not freed by an autocmd */ ! if (!qflist_valid(wp, qfid)) { ! if (wp != NULL) { + /* An autocmd has freed the location list. */ EMSG(_(e_loc_list_changed)); return FALSE; } + else + { + /* Quickfix list is not found, create a new one. */ + qf_new_list(qi, title); + return TRUE; + } } + if (qi->qf_lists[qi->qf_curlist].qf_id != qfid) /* Autocommands changed the quickfix list. Find the one we were * using and restore it. */ ! qi->qf_curlist = qf_id2nr(qi, qfid); return TRUE; } *** *** 4424,4433 char_u*p; int fi; qf_info_T *qi = &ql_info; - int loclist_cmd = FALSE; int_u save_qfid; ! qfline_T *cur_qf_start; ! win_T *wp; buf_T *buf; int duplicate_name = FALSE; int using_dummy; --- 4431,4438 char_u*p; int fi; qf_info_T *qi = &ql_info; int_u save_qfid; ! win_T *wp = NULL; buf_T *buf; int duplicate_name = FALSE; int using_dummy; *** *** 4461,4467 qi = ll_get_or_alloc_list(curwin); if (qi == NULL) return; ! loclist_cmd = TRUE; } if (eap->addr_count > 0) --- 4466,4472 qi = ll_get_or_alloc_list(curwin); if (qi == NULL) return; ! wp = curwin; } if (eap->addr_count > 0) *** *** 4518,4527 * ":lcd %:p:h" changes the meaning of short path names. */ mch_dirname(dirname_start, MAXPATHL); ! /* Remember the current values of the quickfix list and qf_start, so that ! * we can check for autocommands changing the current quickfix list. */ save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; - cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start; seconds = (time_t)0; for (fi = 0; fi < fcount && !got_int && tomatch > 0; ++fi) --- 4523,4531 * ":lcd %:p:h" changes the meaning of short path names. */ mch_dirname(dirname_start, MAXPATHL); ! /* Remember the current quickfix list identifier, so that we can check for ! * autocommands changing the current quickfix list. */ save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; seconds = (time_t)0; for (fi = 0; fi < fcount && !got_int && tomatch > 0; ++fi) *** *** 4549,4559 /* Use existing, loaded buffer. */ using_dummy = FALSE; ! /* Check whether the quickfix list is still valid */ ! if (!vgr_qflist_valid(qi, save_qfid, cur_qf_start, loclist_cmd, ! *eap->cmdli
Re: [vim/vim] errorformat %r seems to imply %> (#2785)
Hi, On Thu, Apr 5, 2018 at 12:02 PM, Jan Gosmann wrote: > Given this error format: > > set efm=%trror\ l%l\ %m > set efm+=%-P(%f%r > set efm+=%-Q)%r > > and this error log: > > (file1 > Error l2 in file1 > (file2 (file3 > Error l4 in file3 > ) > Error l6 in file2 > (file4 > )) > Error l9 in file 1 again > (file5 > Error l11 in file5 > )(file6 > Error l13 in file6 > )) > > the quickfix list will be populated with the following > > file1|2 error| in file1 > file3|4 error| in file3 > file2|6 error| in file2 > file1|9 error| in file 1 again > file5|11 error| in file5 > || (file6 > file1|13 error| in file6 > > Note that the last error is wrongly reported in file1 instead of file6. The > (file6 part is added to the quickfix list as non-valid entry, though it > should be matched by set efm+=%-P(%f%r rule. It seems that %r implicitely > assumes %>, i.e. restricts matches to the current and following patterns. > > This particular example could be fixed by switching the order of rule in > efm, but doing so will result in other cases that do not work correctly > (i.e. if a file is opened and closed on the same line like (fileA (fileB > (fileC))). > > The documentation strongly suggest that it should be possible what I am > doing here: > > Thus it is possible to parse even nested files like in the following line: > {"file1" {"file2" error1} error2 {"file3" error3 {"file4" error4 error5}}} > > It also references the example of errorformat for LaTeX output which > actually is what I am trying to parse in the end. That example does not work > correctly for the lualatex output I am getting because of the issue > described above. > > Version information > > VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 5 2018 14:36:32) > Included patches: 1-402 > Compiled by Chakra > > I can add further information if requested or relevant. > Can you try the attached patch? It looks like when the support for "%>" was added to 'errorformat' way back in 7.0, this was broken. In my tests, this patch fixes the problem. Can you try this out in other scenarios also to make sure this doesn't introduce any other problems? Thanks, Yegappan diff --git a/src/quickfix.c b/src/quickfix.c index 5c7abe78f..723a3e5d0 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -1118,6 +1118,7 @@ restofline: { STRMOVE(IObuff, skipwhite(tail)); qfl->qf_multiscan = TRUE; + fmt_ptr = fmt_first; goto restofline; } } -- -- 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. For more options, visit https://groups.google.com/d/optout.