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

Error leak leads to confusing place

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: Tue, 26 May 2009 16:21:02 -0400

Saw some "Aborted" message today trying to use a 1.6 client on a trunk
working copy. When I explored the cause, I found a leaked error was to
blame. If you read subversion/libsvn_wc/lock.c:do_open(), you see this
chunk of code (minus the line I'm showing that I added to fix the problem).

  if (! under_construction)
    {
      err = svn_wc_check_wc(path, &wc_format, subpool);

      if (wc_format == 0 || (err && APR_STATUS_IS_ENOENT(err->apr_err)))
        {
          return svn_error_createf(SVN_ERR_WC_NOT_DIRECTORY, err,
                                   _("'%s' is not a working copy"),
                                   svn_path_local_style(path, pool));
        }
+ SVN_ERR(err);
    }

Of course, I was working backwards here, finding a bugfix on the branch and
then looking for the same bug in trunk so I can commit the fix there and
suggest backport. What I find is (surprise, surprise) that the WC code
looks drastically different. I'm pretty sure that the matching chunk of
code is this bit from open_single():

  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool));
  err = svn_wc__internal_check_wc(&wc_format, db, local_abspath, scratch_pool);
  if (wc_format == 0 || (err && APR_STATUS_IS_ENOENT(err->apr_err)))
    {
      return svn_error_createf(SVN_ERR_WC_NOT_DIRECTORY, err,
                               _("'%s' is not a working copy"),
                               svn_path_local_style(path, scratch_pool));
    }
  svn_error_clear(err);

This code doesn't leak the error like the 1.6.x branch code does, though.
So that's a good thing. But I noticed that rather than raise 'err' as I'd
expect, trunk just clears it with no nearby comment explaining why it's okay
to do that.

Does anyone know the reason why?

What should be done for 1.6.x in terms of fixing this?

-- 
C. Michael Pilato <cmpilato_at_collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2354191

Received on 2009-05-26 22:21:31 CEST

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.