[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: BUG: svn enters unkillable state, tracked down to UTF conv in locale!=C

From: Denis Vlasenko <vda.linux_at_googlemail.com>
Date: 2006-07-04 15:28:38 CEST

On Tuesday 04 July 2006 14:51, Malcolm Rowe wrote:
> Sounds very much like this is a glibc problem (or possibly an
> APR/glibc-2.4 problem).
>
> Which version of APR are you using? Ah, is it pre-APR 0.9.9?
> From APR 0.9.9's CHANGES file:
>
> *) Fix apr_strerror() with glibc 2.4. [Joe Orton]

Something very fishy here...

static char *native_strerror(apr_status_t statcode, char *buf,
                             apr_size_t bufsize)
{
int r = strerror_r(statcode, buf, bufsize);
if (r < 0) {
    //enum { r = 0 };
    //if (strerror_r(statcode, buf, bufsize) < 0) {
fprintf(stderr, "%s: strerror_r()==%d, return stuffbuffer('APR does not understand this error code')\n", __FUNCTION__, r); //vda
        return stuffbuffer(buf, bufsize,
                           "APR does not understand this error code");
    }
    else {
fprintf(stderr, "%s: strerror_r(%d,buf,%d)==%d, return '%s'\n", __FUNCTION__, statcode, bufsize, r, buf); //vda
        return buf;
    }
}

The above code works more-or-less okay:
...
apr_strerror: native_strerror
native_strerror: strerror_r()==-1481340491, return stuffbuffer('APR does not understand this error code')
...

but if I delete "int r = strerror_r(statcode, buf, bufsize); if (r < 0) {"
lines and uncomment next two ones, it starts to return someting >=0 from strerror_r()
but does not modify buf, and subsequently enters infinite lop.

This is it. We use POSIX prototype, yet somehow link with glibc's strerror_r
which returns char*:

# nm errorcodes.o | grep strerror
00000026 T apr_strerror
         U gai_strerror
         U hstrerror
         U strerror_r

A small test program

#include <errno.h>
#include <string.h>
#include <stdio.h>
int main() {
  char buf[1024] = "junk";
  strerror_r(ERANGE, buf, 1024);
  return 0;
}

has different symbol referenced, the POSIX one:

# nm t.o | grep strerror
         U __xpg_strerror_r

--
vda
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jul 4 15:30:42 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.