[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: strange vim startup/loading error



 

> -----Original Message-----
> From: Brian Long
> 
> On Fri, 2006-04-21 at 16:45 -0400, Marc Wiatrowski wrote:
> 
> > 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?
> 
> No, I'm running Update 2, but vim-common is the same version you list.
> I created your test.txt file and I have no problems opening it.
> 

Must be something with my machine then...  Thanks for looking at that 
brian. (btw I'm working outta Apex)

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?

thanks for all your help,
marc


/*
 * 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;

    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;
    }
    return OK;
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]