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

Re: Assertion failed: is_canonical (base, blen)

From: Maxim Abrashkin <max-av_at_yandex.ru>
Date: 2005-09-14 04:33:13 CEST

Hello,

SteveKing wrote:
>
>
> This won't solve the problem but make it even worse!
> You just compile the project without the assert() function, which makes
> then the program crash.

In this case program not crashed.

 From my point of view, assert in release build must not be present at all!

> The assertion is there for a reason! That means the code there assumes
> that the URL is canonical and doesn't work correctly if it isn't.
>
> To really fix this, you'd have to find out *why* it asserts there and
> fix *that* problem.
>
> Stefan
>

Let's look at code in libsvn_subr/path.c.
What is_canonical function do?
-----------------------------------
#ifndef NDEBUG
static svn_boolean_t
is_canonical (const char *path,
               apr_size_t len)
{
   return (! SVN_PATH_IS_PLATFORM_EMPTY (path, len)
           && (len <= 1 || path[len-1] != '/'));
}
#endif
-----------------------------------
Yes, it checks path. But last condition "path[len-1] != '/')" makes me
crazy ;) (i seen this assert in this case), why don't allow '/' at the
end of path? I don't know.
So if this symbol incorrect at the end of path it must not be checked in
assert, but processed in normal way.

This function placed in #ifndef NDEBUG section, so it does not work in
release build (if release definitions is ok).

I can't find any problem with my subversion release build (with NDEBUG
defined), all code worked as expected.

--
Maxim
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Sep 14 04:35:32 2005

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