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

Re: Fwd: [Issue 2399] svn_ra_stat returning error for non-existent path instead of NULL dirent_t*

From: Max Bowsher <maxb_at_ukf.net>
Date: 2005-09-13 15:34:26 CEST

Erik Huelsmann wrote:
>>> I agree that this is orthogonal to the semantic
>>> discussion about when a
>>> path is considered not to exist, but I don't
>>> understand why you can't get
>>> what you want today.
>> Turn it on its head for minute.
>> What client code requires svn_ra_stat to return an
>> error in this situation? None I'll bet, because it is
>> undocumented and flies in the face of svn_ra_stat's
>> contract.
>> In which case, why not fix it up?
>> Its a single line change to the code.
>> Return a NULL dirent_t* instead of returning an error.
> Ah, but there you have a point.
> Looking at the doxygen comment (snippet taken from
> http://hix.nu/subversion/lxr/source/subversion/include/svn_ra.h#928):
> 919 /**
> 920 * Set @a *dirent to an @c svn_dirent_t associated with @a path at @a
> 921 * revision. @a path is relative to the @a session's parent's URL.
> 922 * If @a path does not exist in @a revision, set @a *dirent to NULL.
> 923 *
> 924 * Use @a pool for memory allocation.
> 925 *
> 926 * @since New in 1.2.
> 927 */
> 928 svn_error_t *svn_ra_stat (svn_ra_session_t *session,
> 929 const char *path,
> 930 svn_revnum_t revision,
> 931 svn_dirent_t **dirent,
> 932 apr_pool_t *pool);
> you're right. This is a bug then.

I don't think this is a bug.

Take the example of the 'ls' unix command - it distinguishes between 'No
such file or directory' and 'Not a directory'.
svn_ra_stat does not violate its docstring, because it does not specify what
the behaviour is in this corner case.
The path neither fully exists, nor does it fully not exist - you could not
create an object with that name without deleting the obstructing file.

I believe the proper remedy is to draw attention to the fact that
SVN_ERR_FS_NOT_DIRECTORY may be raised - not to make this error case
indistinguishable from a simple 'does not exist' return.


To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Sep 13 15:35:32 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.