[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: Malcolm Rowe <malcolm-svn-dev_at_farside.org.uk>
Date: 2006-07-04 10:59:52 CEST

On Tue, Jul 04, 2006 at 10:16:41AM +0200, Denis Vlasenko wrote:
> On Monday 03 July 2006 18:33, Malcolm Rowe wrote:
> > > xlate.c:apr_xlate_conv_buffer():353 iconv() inbytes_left=0 outbytes_left=11 translated=0 errno=2 inbuf='.svn/format'
> > > xlate.c:apr_xlate_conv_buffer():353 iconv() inbytes_left=2 outbytes_left=2 translated=-1 errno=7 inbuf='5.Р╖Ь(Д╖╪JЦ╞ .С╖^M'
> >
> > ... could you get a backtrace from the svn_io_file_open() call that opens
> > this file? Yes, if we're trying to open a file with a garbage name,
> > that's probably a bug.
>
> The call chain is:
>
> svn_io_file_open():

I was actually more interested in a backtrace - i.e. where the call was
coming from. But it occurs to me that there's no way we can tell that
the string above is actually supposed to be a filename, so that probably
doesn't help.

> The filename is passed to svn_error_wrap_apr() in third argument,
> but svn_error_wrap_apr() is a variadic function and:
>
> svn_error_t *
> svn_error_wrap_apr (apr_status_t status,
> const char *fmt,
> ...)
> {
> svn_error_t *err, *utf8_err;
> va_list ap;
> char errbuf[255];
> const char *msg_apr, *msg;
>
> err = make_error_internal (status, NULL);
>
> if (fmt)
> {
> /* Grab the APR error message. */
> apr_strerror (status, errbuf, sizeof (errbuf));
> utf8_err = svn_utf_cstring_to_utf8 (&msg_apr, errbuf, err->pool); // <---- HERE
> if (utf8_err)
> msg_apr = NULL;
> svn_error_clear (utf8_err);
>
> /* Append it to the formatted message. */
> va_start (ap, fmt);
> msg = apr_pvsprintf (err->pool, fmt, ap);
> va_end (ap);
> err->message = apr_psprintf (err->pool, "%s%s%s", msg,
> (msg_apr) ? ": " : "",
> (msg_apr) ? msg_apr : "");
> }
>
> return err;
> }
>
> See? we call svn_utf_cstring_to_utf8() but it has no chance in hell
> to get a filename, because va_start() is not yet called,
> and therefore it has no way to obtain 3rd argument.
>

No, that's fine. The generated error message is in the form
"<fmt,variadic arguments>: <APR error message>". In our example, it
might be something like "Can't open file 'foo': File not found".

The first section (including the line you highlighted) only looks up
the APR error message, which doesn't contain any format strings, and
doesn't reference the filename.

> I inserted a fprintf(stderr, "%s: errbuf='%s'\n", __FUNCTION__, errbuf)
> directly after apr_strerror (status, errbuf, sizeof (errbuf))
> call and I see this:
>
> svn_io_file_open: fname='busybox/.svn/dir-props'
> svn_error_wrap_apr: errbuf='ФЁ╧╖юдд╖.╗Ю╖..╟╞h.╟╞A.Ю╖юдд╖.╗Ю╖Л╖Ю╖a.'

That is interesting though. I'd be interested to know what 'status' is at
this point, and whether errbuf is just what was in the buffer originally,
or whether it's been filled by apr_strerror() [and in that case, is it
possible that it's the native error message in the native codepage?].

Regards,
Malcolm

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jul 4 11:01:41 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.