This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Vim initialization and DOS CR/LF file mode & possible fix


Hi, 

Vim recently started behaving annoyingly on startup. I know I have used
cygwin setup since before the problem appeared so it may be a new
version or I may have changed the CR/LF text mode. But now neither
setting of DOS/unix text modes seem to fix the problem.

Whenever I start vim, I get

Can't read file /tmp/v12292/0
Can't read file /tmp/v12292/1

It turns out it's trying to look for plugin files. Since I don't have
any it doesn't bother me that it doesn't load them, but the messages and
the delays are annoying.

What happens is to find which files exist it will
"/$HOME/.vim/plugin/*.vim", by executing "unset nonomatch; echo
>/tmp/v12292/0 /cygdrive/f/docume~1/quarl/.vim/plugin/*.vim".

When vim reads the temp file, it first does an fseek(SEEK_END) and
ftell(), then compares the size returned by ftell() to the amount read
by fread(). Now, this size will be different under cygwin because ftell
doesn't take into account the '\r's, but fread() does. The code below it
appears specifically to not deal with '\r's so using binary mode to read
the file would not be an easy solution.

#line os_unix.c 4515
    fd = fopen((char *)tempname, "r");
    if (fd == NULL) {/*...*/}
    fseek(fd, 0L, SEEK_END);
    len = ftell(fd);			/* get size of temp file */
    fseek(fd, 0L, SEEK_SET);
    buffer = alloc(len + 1);
    if (buffer == NULL)  {/*...*/}
    i = fread((char *)buffer, 1, len, fd);
    fclose(fd);
    mch_remove(tempname);
    if (i != len)
    {
	/* unexpected read error */
	EMSG2(_(e_notread), tempname);
	vim_free(tempname);
	vim_free(buffer);
	return FAIL;
    }

Replacing the line "if (i != len)" with
#ifdef __CYGWIN__
    if (i != len && i != len-1)
#else
    if (i != len)
#endif

works but seems like a stupid kludge. Is there a better solution,
especially since this seems like a problem that will appear elsewhere.

Cygwin Package Information
Package             Version
bash                2.05a-3
cygwin              1.3.10-1
vim                 6.1-2
vim-src             6.1-2

Thanks in advance.

-- 
quarl / Karl Chen 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]