Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Reply-To: From: "Karl Chen" To: Subject: Vim initialization and DOS CR/LF file mode & possible fix Date: Fri, 5 Apr 2002 05:16:23 -0800 Message-ID: <000001c1dca4$16548670$6401a8c0@hfb.quarl.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Importance: Normal 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/