[Top][All Lists]

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

error messages truncated

From: Brandon Craig Rhodes
Subject: error messages truncated
Date: 24 Jun 2002 17:13:04 -0400
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp)

While debugging remote CVS access recently I was receiving very
uninformative error messages - trying `cvs version' to a remote
server, for instance, resulted in errors like:

    cvs [version aborted]: error from server cvs

But every few dozen tests, I would be startled by a more complete
error message like:

    cvs [version aborted]: error from server cvs [pserver 
aborted]: could not acquire GSSAPI server credentials

Packet sniffing verified that the entire error message was being sent
every time, but for some reason the CVS client was not reporting it! 
When I examined the code for receiving server error messages I found
the following code in connect_to_gserver(...) from client.c:

                got = recv (sock, buf + 2, sizeof buf - 2, 0);
                if (got < 0)
                    error (1, 0, "recv() from server %s: %s",
                           root->hostname, SOCK_STRERROR (SOCK_ERRNO));
                buf[got + 2] = '\0';
                if (buf[got + 1] == '\n')
                    buf[got + 1] = '\0';
                error (1, 0, "error from server %s: %s", root->hostname,

This only works if the entire error message is delivered in a single
recv(...)  call!  Which depends on the behavior of the networking
stacks of both the server's and client's operating systems - in my
case the message was apparently getting split into several packets and
the recv(...) was returning after receiving the first one.

The correct behavior is of course to put recv(...) in a loop that
continues filling buf[] until it reaches some terminating condition,
such as when it sees a newline.  I have tested this and it solves my
problem.  Does it look to those of you with more experience with CVS
as though I have diagnosed this problem correctly?  Should I submit
this as a patch?

Brandon Craig Rhodes               
Georgia Tech                                            address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]