repeatable vim recovery failure

150 views
Skip to first unread message

David M. Besonen

unread,
Oct 21, 2009, 9:04:17 PM10/21/09
to vim users
win xp home sp3
gvim 7.2


issue: vim recovery will not work unless orphaned vim swap
file extension begins with "sw"


scenario:

os crashes while gvim has a number of unnamed editing
sessions opened

after rebooting the os, i locate the orphaned vim swap file

the file is named _.svz (windoze crashes a lot)

when i attempt "vim -r _.svz" this message is returned:
"E305: No swap file found for _.svz"

i then change the filename to _.swz
and issue the "vim -r _.swz" command
and the file is recovered


can anyone confirm this same behavior? and whether this is a
bug or a feature?

thanks,
david

David M. Besonen

unread,
Oct 27, 2009, 1:05:25 PM10/27/09
to vim...@googlegroups.com
ping. (should i send this to the dev list?)

Christophe-Marie Duquesne

unread,
Oct 27, 2009, 2:02:45 PM10/27/09
to vim...@googlegroups.com
I am not a vim developper, but to me your mail looks more like a bug
report than a question about vim use. I think you should send it to
vim_dev.
--
Christophe-Marie Duquesne

Christophe-Marie Duquesne

unread,
Oct 27, 2009, 2:03:44 PM10/27/09
to vim...@googlegroups.com
On Tue, Oct 27, 2009 at 7:02 PM, Christophe-Marie Duquesne
<chm.du...@gmail.com> wrote:
> I am not a vim developper, but to me your mail looks more like a bug
> report than a question about vim use. I think you should send it to
> vim_dev.

And obviously don't do like me, avoid top posting.

Dominique Pellé

unread,
Oct 27, 2009, 5:24:17 PM10/27/09
to vim...@googlegroups.com
David M. Besonen wrote:


I can reproduce it on Linux too (Vim-7.2.267). File ".svz" can't be
recovered with "vim -r .svz". And Ex command ":recover .svz" gives
the following error:

"E305: No swap file found for .svz"

But file can successfully be recovered after renaming it:

$ mv .svz .swz
$ vim -r .swz

I suppose that it's a bug.
-- Dominique

Lily

unread,
Oct 29, 2009, 10:47:38 AM10/29/09
to vim_use
:h E326
and it said it won't check other names until the previous names have
been found.
So I think it is a feature. But generating a _.svz while no _.swp
seems to be a bug.

Charles Campbell

unread,
Oct 29, 2009, 11:08:47 AM10/29/09
to vim...@googlegroups.com
Please bottom post on this list. Quote a small (relevant) part of the
message you are replying to, and put your text underneath.

The guidelines for the list may be found at:
http://groups.google.com/group/vim_use/web/vim-information

Chip Campbell


Bram Moolenaar

unread,
Oct 29, 2009, 5:05:48 PM10/29/09
to David M. Besonen, vim users

David M. Besonen wrote:

It used to be a feature, but I can understand it can be annoying.

Let's extend the range of files recognized as a swap file to:

.s[uvw][a-z]


*** ../vim-7.2.267/src/memline.c 2009-04-22 15:56:27.000000000 +0200
--- src/memline.c 2009-10-29 20:55:08.000000000 +0100
***************
*** 864,884 ****
recoverymode = TRUE;
called_from_main = (curbuf->b_ml.ml_mfp == NULL);
attr = hl_attr(HLF_E);
! /*
! * If the file name ends in ".sw?" we use it directly.
! * Otherwise a search is done to find the swap file(s).
! */
fname = curbuf->b_fname;
if (fname == NULL) /* When there is no file name */
fname = (char_u *)"";
len = (int)STRLEN(fname);
if (len >= 4 &&
#if defined(VMS) || defined(RISCOS)
! STRNICMP(fname + len - 4, "_sw" , 3)
#else
! STRNICMP(fname + len - 4, ".sw" , 3)
#endif
! == 0)
{
directly = TRUE;
fname = vim_strsave(fname); /* make a copy for mf_open() */
--- 864,887 ----
recoverymode = TRUE;
called_from_main = (curbuf->b_ml.ml_mfp == NULL);
attr = hl_attr(HLF_E);
!
! /*
! * If the file name ends in ".s[uvw][a-z]" we assume this is the swap file.
! * Otherwise a search is done to find the swap file(s).
! */
fname = curbuf->b_fname;
if (fname == NULL) /* When there is no file name */
fname = (char_u *)"";
len = (int)STRLEN(fname);
if (len >= 4 &&
#if defined(VMS) || defined(RISCOS)
! STRNICMP(fname + len - 4, "_s" , 2)
#else
! STRNICMP(fname + len - 4, ".s" , 2)
#endif
! == 0
! && vim_strchr((char_u *)"UVWuvw", fname[len - 2]) != NULL
! && ASCII_ISALPHA(fname[len - 1]))
{
directly = TRUE;
fname = vim_strsave(fname); /* make a copy for mf_open() */

--
TIM: To the north there lies a cave, the cave of Caerbannog, wherein, carved
in mystic runes, upon the very living rock, the last words of Olfin
Bedwere of Rheged make plain the last resting place of the most Holy
Grail.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Tony Mechelynck

unread,
Nov 22, 2009, 8:37:55 PM11/22/09
to vim...@googlegroups.com, Bram Moolenaar, David M. Besonen, vim users
On 29/10/09 22:05, Bram Moolenaar wrote:
>
>
> David M. Besonen wrote:
>
>> win xp home sp3
>> gvim 7.2
>>
>> issue: vim recovery will not work unless orphaned vim swap
>> file extension begins with "sw"
>>
>>
>> scenario:
>>
>> os crashes while gvim has a number of unnamed editing
>> sessions opened
>>
>> after rebooting the os, i locate the orphaned vim swap file
>>
>> the file is named _.svz (windoze crashes a lot)
>>
>> when i attempt "vim -r _.svz" this message is returned:
>> "E305: No swap file found for _.svz"
>>
>> i then change the filename to _.swz
>> and issue the "vim -r _.swz" command
>> and the file is recovered
>>
>> can anyone confirm this same behavior? and whether this is a
>> bug or a feature?
>
> It used to be a feature, but I can understand it can be annoying.
>
> Let's extend the range of files recognized as a swap file to:
>
> .s[uvw][a-z]

According to ":help E326", and as confirmed by inspecting the source,
swap files with any extension in the range .saa to .swp can be
generated, which admittedly is many, maybe even _too_ many. Why not
avoid generating swapfiles which Vim will never accept to recover
without a rename, for instance by changing

if (fname[n - 2] == 'a') /* ".saa": tried enough, give up */

to

if (fname[n - 2] == 'u') /* ".sua": tried enough, give up */

at memline.c:4262 (as of Vim 7.2.302 sources)?

(The corresponding doc § is at recover.txt:50).



Best regards,
Tony.
--
Every program has two purposes -- one for which it was written and
another for which it wasn't.
Reply all
Reply to author
Forward
0 new messages