E749 on switching to buffer

115 views
Skip to first unread message

itchyny

unread,
Jul 26, 2015, 7:46:05 AM7/26/15
to vim_dev
Vim warns E749 on switching to a buffer which used to be checked diff.

How to reproduce.
1. vim -u NONE -N
2. :e test | diffthis
3. :vnew test2 | diffthis
4. :e test3
5. :buffer #

Error message
E749: empty buffer

What I expect
Vim opens the test2 with no error message.

Environment
Vim 7.4.796
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jul 23 2015 08:48:19)
MacOS X (unix) version
Included patches: 1-796
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
+acl +cmdline_hist -dnd -footer +lispindent -mouse_jsbterm +perl +scrollbind -tcl +viminfo -xterm_save
+arabic +cmdline_info -ebcdic +fork() +listcmds +mouse_netterm +persistent_undo +signs +terminfo +vreplace -xpm
+autocmd +comments +emacs_tags -gettext +localmap +mouse_sgr +postscript +smartindent +termresponse +wildignore
-balloon_eval +conceal +eval -hangul_input +lua -mouse_sysmouse +printer -sniff +textobjects +wildmenu
-browse +cryptv +ex_extra +iconv +menu +mouse_urxvt +profile +startuptime +title +windows
++builtin_terms +cscope +extra_search +insert_expand +mksession +mouse_xterm +python +statusline -toolbar +writebackup
+byte_offset +cursorbind +farsi +jumplist +modify_fname +multi_byte -python3 -sun_workshop +user_commands -X11
+cindent +cursorshape +file_in_path +keymap +mouse +multi_lang +quickfix +syntax +vertsplit -xfontset
-clientserver +dialog_con +find_in_path +langmap -mouseshape -mzscheme +reltime +tag_binary +virtualedit -xim
+clipboard +diff +float +libcall +mouse_dec +netbeans_intg +rightleft +tag_old_static +visual -xsmp
+cmdline_compl +digraphs +folding +linebreak -mouse_gpm +path_extra +ruby -tag_any_white +visualextra -xterm_clipboard
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -Os -w -pipe -march=core2 -msse4.1 -mmacosx-version-min=10.10 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang -L. -L/usr/local/lib -L/usr/local/lib -Wl,-headerpad_max_install_names -o vim -lm -lncurses -liconv -framework Cocoa -pagezero_size 10000 -image_base 10000000
0 -L/usr/local/lib -lluajit-5.1 -fstack-protector -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -framework Python -lruby.2.0.0 -lobjc

Hope it fixed. Thanks.

h_east

unread,
Jul 31, 2015, 10:07:24 AM7/31/15
to vim_dev, nekneknek...@gmail.com
Hi itchyny,

2015-7-26(Sun) 20:46:05 UTC+9 itchyny:
> Vim warns E749 on switching to a buffer which used to be checked diff.
>
> How to reproduce.
> 1. vim -u NONE -N
> 2. :e test | diffthis
> 3. :vnew test2 | diffthis
> 4. :e test3
> 5. :buffer #
>
> Error message
> E749: empty buffer
>
> What I expect
> Vim opens the test2 with no error message.
...snip...
> Hope it fixed. Thanks.


I can reproduced.

Places that are output E749 is four. In this case it is output in the following locations.

fileio.c (in function buf_write())
3167 if (buf->b_ml.ml_mfp == NULL)
3168 {
3169 /* This can happen during startup when there is a stray "w" in the
3170 * vimrc file. */
3171 EMSG(_(e_emptybuf));
3172 return FAIL;
3173 }

And It's backtrace at this time.
(gdb) bt
#0 buf_write (buf=0x1a961b0, fname=0x1a9d3c0 "/tmp/vCVByI3/4", sfname=0x0,
start=1, end=1, eap=0x0, append=0, forceit=0, reset_changed=0, filtering=1)
at fileio.c:3171
#1 0x0000000000414743 in diff_write (buf=0x1a961b0,
fname=0x1a9d3c0 "/tmp/vCVByI3/4") at diff.c:645
#2 0x0000000000414b21 in ex_diffupdate (eap=0x0) at diff.c:809
#3 0x00000000004160e3 in diff_check (wp=0x1a921b0, lnum=1) at diff.c:1520
#4 0x000000000041463b in diff_redraw (dofold=1) at diff.c:618
#5 0x0000000000413868 in diff_buf_add (buf=0x1a961b0) at diff.c:137
#6 0x0000000000405d42 in enter_buffer (buf=0x1a961b0) at buffer.c:1542
#7 0x0000000000405c7d in set_curbuf (buf=0x1a961b0, action=0) at buffer.c:1507
#8 0x0000000000405a16 in do_buffer (action=0, start=1, dir=1, count=2,
forceit=0) at buffer.c:1403
#9 0x0000000000404bdb in goto_buffer (eap=0x7ffed7d77d30, start=1, dir=1,
count=2) at buffer.c:775
#10 0x000000000046c2fa in ex_buffer (eap=0x7ffed7d77d30) at ex_docmd.c:5494
#11 0x000000000046795c in do_one_cmd (cmdlinep=0x7ffed7d783c8, sourcing=0,
cstack=0x7ffed7d77f20, fgetline=0x47ce87 <getexline>, cookie=0x0)
at ex_docmd.c:2941
#12 0x00000000004647b7 in do_cmdline (cmdline=0x0,
fgetline=0x47ce87 <getexline>, cookie=0x0, flags=0) at ex_docmd.c:1133
#13 0x00000000004ec941 in nv_colon (cap=0x7ffed7d784f0) at normal.c:5405
#14 0x00000000004e5d8c in normal_cmd (oap=0x7ffed7d785d0, toplevel=1)


The fileio.c:3169 comments do not know well to me.. ( ゚д゚)
However, I have taken measures so as not to come here when the 'diff'.

Please check attached patch.

--
Best regards,
Hirohito Higashi (a.k.a h_east)
diff_E749_fix.patch

itchyny

unread,
Aug 1, 2015, 5:19:47 AM8/1/15
to vim_dev, nekneknek...@gmail.com
Thank you so much, h_east-san.

I actually confirmed that your patch fixes the issue.
Bram, what do you think of this bug and the patch of h_east?
Reply all
Reply to author
Forward
0 new messages