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

Re: Problem with svn cat

From: <kfogel_at_collab.net>
Date: 2003-10-17 16:15:13 CEST

Jason Rust <jrust@rustyparts.com> writes:
> I'm trying to get chora (http://horde.org) up and running with
> subversion and keep hitting the following problem:
> When apache tries to run svn cat file:///path/to/file it gives the
> error:
> svn: Ran out of unique names
> svn: svn_io_open_unique_file: unable to make name for ''

Cross-posting to dev to explain how we ended up with such a bad error.
("Ran out of unique names" is obviously not helpful when the problem
is really permissions!)

The relevant code is here in svn_io_open_unique_file():

   begin loop from 1 to 99999:
      apr_err = apr_file_open (f, unique_name_apr, flag,
                               APR_OS_DEFAULT, pool);

      if (APR_STATUS_IS_EEXIST(apr_err) || APR_STATUS_IS_EACCES(apr_err))
      else if (apr_err)
          *f = NULL;
          *unique_name_p = NULL;
          return svn_error_createf
            (apr_err, NULL,
             "svn_io_open_unique_file: error opening '%s'", unique_name);
          *unique_name_p = unique_name;
          return SVN_NO_ERROR;

  *f = NULL;
  *unique_name_p = NULL;
  return svn_error_createf (SVN_ERR_IO_UNIQUE_NAMES_EXHAUSTED,
                            "svn_io_open_unique_file: unable to make name for "
                            "'%s'", path);

SVN_ERR_IO_UNIQUE_NAMES_EXHAUSTED will eventually be returned even if
the underlying errors were APR_STATUS_IS_EACCES(). So why is EACCES
one of the continuation conditions, when that error usually represents
a permission problem?

Time to break out the 'svn blame'...

   $ svn blame subversion/libsvn_subr/io.c
     4417 brane apr_err = apr_file_open (f, unique_name_apr, flag,
      125 sussman APR_OS_DEFAULT, pool);
        1 svn
     6838 mbk if ([...] || APR_STATUS_IS_EACCES(apr_err))
        1 svn continue;
        1 svn else if (apr_err)
        1 svn {
        1 svn *f = NULL;
     4352 kfogel *unique_name_p = NULL;
     4352 kfogel return svn_error_createf
     4352 kfogel (apr_err, NULL,
     6286 cmpilato "svn_io_open_unique_file: error [...]
     4352 kfogel }
Ironically, it's MBK :-). He had a good reason, though:

   $ tools/client-side/showchange.pl 6838
   rev 6838: mbk | 2003-08-22 18:19:56 -0500 (Fri, 22 Aug 2003) | 9 lines
   Changed paths:
      M /trunk/subversion/libsvn_subr/io.c
   Fix issue 1487, "svn diff -r PREV:HEAD fails if tmp/ exists in current
   directory". This was happening because on Win32, CreateFile fails
   with an "Access Denied" error code, rather than "File Already Exists",
   if the colliding name belongs to a directory.
   * subversion/libsvn_subr/io.c
     (svn_io_open_unique_file): Continue on APR_STATUS_IS_EACCES as well as
   Index: subversion/libsvn_subr/io.c
   --- subversion/libsvn_subr/io.c (revision 6837)
   +++ subversion/libsvn_subr/io.c (revision 6838)
   @@ -155,7 +155,7 @@
          apr_err = apr_file_open (f, unique_name_apr, flag,
                                   APR_OS_DEFAULT, pool);
   - if (APR_STATUS_IS_EEXIST(apr_err))
   + if (APR_STATUS_IS_EEXIST(apr_err) || APR_STATUS_IS_EACCES(apr_err))
          else if (apr_err)

I've got a local mod that fixes this by making the conditional
structure a little more sensitive. Will commit after 'make check' is


To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Oct 17 16:52:03 2003

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.