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

RE: ISSUE+PATCH: author & date of logentry can be empty in specific situation, problems with log.dtd & javahl

From: Peter N. Lundblad <peter_at_famlundblad.se>
Date: 2005-08-08 22:23:46 CEST

On Mon, 8 Aug 2005, Lieven Govaerts wrote:

> >> 2. I made a Java application using the javahl bindings, doing the same
> >> log request. Both on Windows as Linux this application will crash the
> >> Java VM.
> >> LogMessage[] lms = cl.logMessages("http://www.mobsol.be/svn/public",\
> >> null, null);
> >> System.out.println(lms.toString());
> >> This happens in the MessageReceiver callback function in SVNClient.cpp.
> >>
> >> Attached to this mail is a patch for SVNClient.cpp. The patch makes
> >> sure that the date object returned to the Java client is 'null' in
> >> this situation, by testing specifically for that situation. Other
> >> solution might be to fix function svn_time_from_cstring to return NULL
> >> when date is NULL.
> >>
> >I know nothing about JavaHL, so I can't test the patch. By looking at it,
> it seems like you introduce the same bug I'm fixing in my upcoming commit,
> namely that an
> >empty date string should be treated as no date at all. It is strange, but
> it is documented in the API docs:-)
> >
> Actually, this patch does two things:
> 1. Check if the date in the log entry is empty; in that case avoid the call
> to svn_time_from_cstring.

No, it checks for the date being NULL, which is not the same as an empty
string. You need something like:
if (date != NULL && date[0] != '\0')
(you can get rid of the explicit comparisons if you like). That checks for
both a null date and an empty one. Read the docstring for
svn_log_msg_receiver_t and you'll see that either a NULL date or an empty
one will count as "no date". I have no clue to why it is that way, but you
can actually trigger it by setting the svn:date property to an empty
string (instead of deleting it).

> This makes it acting the same as for the empty author field, which is also
> null when returned to Java.
>
I haven't checked, but does it really special-case an *empty* author? I
think you mean NULL here.

> Actually, I don't know how you normally handle parameter validation ( is it
> the job of the caller? )
> but I would expect the function svn_time_from_cstring to return NULL when
> date with value NULL
> is passed to it.
>
It is normally the job of the caller to avoid programming errors like
passing invalid arguments. That's how we do it in svn; there are arguments
for and against it. For svn_time_from_cstring, if we added a check for a
null string, we would return an error. That would avoid the crash, but
you'd still not get the log you wanted. Better to fix the javahl bindings
then, which contain the real bug.

> If you'll update the DTD's, I'll also update the XSD files I created a few
> days ago, and post them again
> to this list.
>
See r15631.

I hope someone will take care of the JavaHL bug.

Thanks,
//Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Aug 8 22:24:49 2005

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.