BUG: Filename containing ! not properly resolved / escaped on Windows

20 views
Skip to first unread message

Ingo Karkat

unread,
Jan 22, 2009, 11:16:41 AM1/22/09
to vim...@googlegroups.com
Hello VIM developers,

While trying out the new fnameescape() function in VIM 7.2 on Windows, I noticed
that there's a mismatch between what is escaped and what is accepted by commands
like :edit when the filename contains a '!' character. The ex commands cannot
deal with the escaped '\!' and treat the backslash as a path separator:

vim -N -u NONE
:echo fnameescape('foo!bar.txt')
foo\!bar.txt
:e foo\!bar.txt
"foo\!bar.txt" [New DIRECTORY]

Likewise, the file completion in command-line mode now also escapes the !
character, and a completed :edit command is unable to open the existing file:

cmd /c
echo testfile > foo#bar!baz.txt
"%ProgramFiles%\Vim\vim72\vim" -N -u NONE
:e foo<Tab> " expansion results in:
:e foo\#bar\!baz.txt
"foo#bar\!baz.txt" [New DIRECTORY]

This is a regression from VIM 7.1, which did not escape the '!':

cmd /c
echo testfile > foo#bar!baz.txt
"%ProgramFiles%\Vim\vim71\vim" -N -u NONE
:e foo<Tab> " expansion results in:
:e foo\#bar!baz.txt
"foo#bar!baz.txt" 1L, 11C

This occurs on Windows XP, but not on Linux (there, the ex commands accept the
escaped \!). I've tried both the default VIM - Vi IMproved 7.2 (2008 Aug 9,
compiled Aug 9 2008 18:46:22), GUI and console versions, as well as a fairly
recent VIM 7.2.77 build from the Cream project.

-- best regards, ingo

--
-- Ingo Karkat -- /^-- /^-- /^-- /^-- /^-- /^-- http://ingo-karkat.de/ --
--
Opinions are like assholes -- everyone's got one, but nobody wants to
look at the other guy's. -- Hal Hickman

Reply all
Reply to author
Forward
0 new messages