Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 07 Feb 1998 11:21:24 -0800
From:      John Polstra <jdp@polstra.com>
To:        scottm@cs.ucla.edu
Cc:        current@FreeBSD.ORG
Subject:   Re: cvs bug (and fix)
Message-ID:  <199802071921.LAA18068@austin.polstra.com>
In-Reply-To: <199802062246.OAA03856@mordred.cs.ucla.edu>
References:  <199802062246.OAA03856@mordred.cs.ucla.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <199802062246.OAA03856@mordred.cs.ucla.edu>,
Scott Michel  <scottm@cs.ucla.edu> wrote:
> This one's been driving me batshit for the last couple of days. I'm
> surprised no one else has encountered it yet.
> 
> Line 6016 in /usr/src/contrib/cvs/src/rcs.c needs to be changed from
> 
>     if (n == EOF)
> 
> to
> 
>     if (n == EOF || num == NULL)  
> 
> Otherwise you get spurious assert's in findnode() a little later on.

It looks like only an invalid RCS file could cause that to happen.
(Which of course doesn't make it any less of a bug.)  Is that right?

> Can someone change, approve, and check this in? TIA

The fix doesn't look quite right to me.  A revision number was
expected, but something else (not EOF) was found instead.  Shouldn't
it report an error?

How about something like this:

    if (n == EOF)
    {
        /* If n == EOF and num == NULL, it means we reached EOF
           naturally.  That's fine. */
        if (num == NULL)
            return NULL;
        else
            error (1, 0, "%s: unexpected EOF", rcs->path);
    }   
    else if (num == NULL)
	error (1, 0, "%s: file contains invalid revision number", rcs->path);

--
   John Polstra                                       jdp@polstra.com
   John D. Polstra & Co., Inc.                Seattle, Washington USA
   "Self-knowledge is always bad news."                 -- John Barth



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802071921.LAA18068>