On 4/24/06, Marc Wiatrowski <[EMAIL PROTECTED]> wrote:
> I have tried the -u NONE option... Still get the same error.
>
> Must be something with my machine then...
>
> I'm no C/programming expert, but it seems my problem is coming from this
> function in src/memfile.c. Specifically the read size check that gives
> the E295 error.
>
> Anyone have any ideas as to why my machine would fail here? Something
> else I could check? A better translation to this code?
It might help if you add printing of size and value returned by read function,
and errno, see below. It would useful to know the exact file size
at this time, too.
> /*
> * read a block from disk
> *
> * Return FAIL for failure, OK otherwise
> */
> static int
> mf_read(mfp, hp)
> memfile_T *mfp;
> bhdr_T *hp;
> {
> off_t offset;
> unsigned page_size;
> unsigned size;
unsigned size, n;
>
> if (mfp->mf_fd < 0) /* there is no file, can't read */
> return FAIL;
>
> page_size = mfp->mf_page_size;
> offset = (off_t)page_size * hp->bh_bnum;
> size = page_size * hp->bh_page_count;
> if (lseek(mfp->mf_fd, offset, SEEK_SET) != offset)
> {
> EMSG(_("E294: Seek error in swap file read"));
> return FAIL;
> }
> if ((unsigned)vim_read(mfp->mf_fd, hp->bh_data, size) != size)
> {
> EMSG(_("E295: Read error in swap file"));
> return FAIL;
Like,
n = (unsigned)vim_read(mfp->mf_fd, hp->bh_data, size);
if( n != size) {
char tmp[200];
sprintf(tmp, ""E295: Read error in swap file (%d,%d,%d)", size,n,errno);
return FAIL;
}
> }
> return OK;
> }
>
> > -----Original Message-----
> > From: Gerald Lai
> >
> > Vim loads up test.txt fine for me. Have you tried:
> >
> > $ vim -u NONE test.txt
> >
> > just to make sure no configuration files are getting in the way.
> >
> > Like you, I'm also on
> >
> > Red Hat Enterprise Linux WS release 4 (Nahant Update 3)
> > using
> > Vim 6.3
> >
> > --
> > Gerald
> >
> > On Fri, 21 Apr 2006, Marc Wiatrowski wrote:
> >
> > > Ok,
> > >
> > > There seems to be size limit, maybe number of lines.. characters
> > > bytes, not sure in reference to the swap file creation? If
> > I generate
> > > a test file with on the RHEL 4 U3 box with vim 6.3.82 (RH
> > 6.3.046-0.40E.7)
> > >
> > > perl -e 'for (my $i=0; $i <= 3509; $i++) { print "This is
> > just one line of text.\n" }' >
> > > test.txt
> > >
> > > and then vim test.txt
> > >
> > > I get:
> > >
> > > E295: Read error in swap file
> > > E316: ml_get: cannot find line 1
> > > Hit ENTER or type command to continue
> > >
> > > Can anyone else reproduce this?
> > >
> > > thanks,
> > > marc