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

Re: [PATCH] (alternate fix for issue 900)

From: mark benedetto king <bking_at_inquira.com>
Date: 2002-09-15 17:25:19 CEST

On Sat, Sep 14, 2002 at 11:02:37AM +0100, Philip Martin wrote:
> svn_repos_open doesn't distinguish between a missing format file and a
> format file it cannot read, both cause the function to return
> SVN_ERR_REPOS_UNSUPPORTED_VERSION. svn_ra_local__split_URL wants to
> distinguish between these two cases. It may be better to change
> svn_repos_open, document the behaviour, and then use that in
> svn_ra_local__split_URL.
>

Let's say we want to (break the API and) modify svn_repos_open to
look like:

svn_error_t *
svn_repos_open (svn_repos_t **repos_p,
                const char *path,
                apr_pool_t *pool,
                svn_boolean_t *found)
{

 [...]

  *found = FALSE;

  err = svn_io_read_version_file
    (&version, svn_path_join (path, SVN_REPOS__FORMAT, pool), pool);
  if (err)
    {
      /* what to do here? We still need to peek inside err to
         determine what went wrong with svn_io_read_version_file.
         if we're willing to peek inside err, why not just do
         that in svn_ra_local__split_URL and not bother breaking
         the API? We can't do some sort of access() style check
         because of the TOC/TOU race condition. We need to know
         why *this* call failed. We could also modify
         svn_io_read_version_file to report more information, but
         it, in turn, calls svn_io_file_open, which would *also* need
         modification.

         If the error chain is truly opaque, then we should move
         the definition into svn_error.c, and use an opaque type
         for svn_error_t. */
      if (0 != SVN_REPOS__VERSION)
        return svn_error_createf
          (SVN_ERR_REPOS_UNSUPPORTED_VERSION, 0, err, pool,
           "Expected version '%d' of repository; found no version at all; "
           "is `%s' a valid repository path?",
           SVN_REPOS__VERSION, path);
    }

  *found = TRUE;

  [...]

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Sep 15 17:32:29 2002

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