You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Kouhei Sutou <ko...@cozmixng.org> on 2008/04/06 08:24:03 UTC

don't use assert()

Hi,

svn_client_mergeinfo_log_merged() uses assert():

  assert(svn_path_is_url(merge_source_url));

It aborts a program when svn_path_is_url returns false. This
behavior may be useful for a stand alone program but isn't
useful for a library. Could you return some svn_error_t *
instead of using assert()?


Thanks,
--
kou

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: don't use assert()

Posted by Kouhei Sutou <ko...@cozmixng.org>.
Hi,

2008/4/7 C. Michael Pilato <cm...@collab.net>:
> Kouhei Sutou wrote:
>>
>> It seems that svn_path_is_url(merge_source_url) is failed
>> easily by user input... And a program will be crashed and a
>> user will see like the following message that is not useful
>> for him:
>>
>>  subversion/libsvn_client/mergeinfo.c:1144:
>> svn_client_mergeinfo_log_merged: Assertion
>> `svn_path_is_url(merge_source_url)' failed.
>
> Right, sure.  So the correct thing to do (as I'm getting rather tired of
> *assert*ing) is for the command-line client to check the input and print the
> nicey nicey error message, leaving the libraries to assert whatever they
> wish to assert.

In the Ruby bindings, if the Subversion library calls abort() and
crashes our program, we can't get a backtrace. It's too
inconvenient to debug our code. We can't get any information
where the problem code. We can only get a file and line in the
Subversion library.

If the Subversion library uses svn_error_t not abort(), we can
get a backtrace for our Ruby codes. It's very helpful to debug
our Ruby codes.


Thanks,
--
kou

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: don't use assert()

Posted by "C. Michael Pilato" <cm...@collab.net>.
Kouhei Sutou wrote:
> It seems that svn_path_is_url(merge_source_url) is failed
> easily by user input... And a program will be crashed and a
> user will see like the following message that is not useful
> for him:
> 
>   subversion/libsvn_client/mergeinfo.c:1144: svn_client_mergeinfo_log_merged: Assertion `svn_path_is_url(merge_source_url)' failed.

Right, sure.  So the correct thing to do (as I'm getting rather tired of 
*assert*ing) is for the command-line client to check the input and print the 
nicey nicey error message, leaving the libraries to assert whatever they 
wish to assert.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand


Re: don't use assert()

Posted by Kouhei Sutou <ko...@cozmixng.org>.
In <47...@gmail.com>
  "Re: don't use assert()" on Sun, 06 Apr 2008 10:28:04 +0200,
  Stefan_Küng <to...@gmail.com> wrote:

> Kouhei Sutou wrote:
> > Hi,
> > 
> > svn_client_mergeinfo_log_merged() uses assert():
> > 
> >   assert(svn_path_is_url(merge_source_url));
> > 
> > It aborts a program when svn_path_is_url returns false. This
> > behavior may be useful for a stand alone program but isn't
> > useful for a library. Could you return some svn_error_t *
> > instead of using assert()?
> 
> Join the club:
> http://subversion.tigris.org/issues/show_bug.cgi?id=2780
> 
> You're not the only one having problems with this...

Ahh...

It seems that svn_path_is_url(merge_source_url) is failed
easily by user input... And a program will be crashed and a
user will see like the following message that is not useful
for him:

  subversion/libsvn_client/mergeinfo.c:1144: svn_client_mergeinfo_log_merged: Assertion `svn_path_is_url(merge_source_url)' failed.


Thanks,
--
kou

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: don't use assert()

Posted by Stefan Küng <to...@gmail.com>.
Kouhei Sutou wrote:
> Hi,
> 
> svn_client_mergeinfo_log_merged() uses assert():
> 
>   assert(svn_path_is_url(merge_source_url));
> 
> It aborts a program when svn_path_is_url returns false. This
> behavior may be useful for a stand alone program but isn't
> useful for a library. Could you return some svn_error_t *
> instead of using assert()?

Join the club:
http://subversion.tigris.org/issues/show_bug.cgi?id=2780

You're not the only one having problems with this...

Stefan


-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net