You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Jason Rust <jr...@rustyparts.com> on 2003/10/16 22:29:10 UTC

Problem with svn cat

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 ''
   
Is there a directory that svn uses for its temporary files that needs to
be writable by apache for this to work?  

Thanks,
-Jason

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Problem with svn cat

Posted by kf...@collab.net.
Jason Rust <jr...@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))
        continue;
      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);
        }
      else
        {
          *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,
                            NULL,
                            "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
      APR_STATUS_IS_EEXIST.
   
   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))
            continue;
          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
done.

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Problem with svn cat

Posted by Jason Rust <jr...@rustyparts.com>.
> >This is a known bug, already fixed, but waiting for a new APR (Apache)
> >release before we can roll out the fix.  The fix creates tmpfiles in a
> >proper system tmpdir, like /tmp.

Thanks, the fix worked.  Looking forward to when its fixed.

-Jason

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Problem with svn cat

Posted by Ben Collins-Sussman <su...@collab.net>.
Brian Mathis <bm...@directedge.com> writes:

> Ben Collins-Sussman wrote:
> [...]
> > This is a known bug, already fixed, but waiting for a new APR (Apache)
> > release before we can roll out the fix.  The fix creates tmpfiles in a
> > proper system tmpdir, like /tmp.
> >
> 
> Techincally the proper system tmpdir is /var/tmp.  /tmp is only there
> for use when booting the system before /var is mounted, and shouldn't
> be used by the general public.

Well, that's the beauty of APR.  Our application just going to call
the brand-new apr_dir_get_temp() function, and APR should
automatically tell us where to create scratchfiles.  If it chooses the
wrong place for a particular OS, we file a bug against APR rather than
Subversion.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Problem with svn cat

Posted by Brian Mathis <bm...@directedge.com>.
Ben Collins-Sussman wrote:
[...]
> This is a known bug, already fixed, but waiting for a new APR (Apache)
> release before we can roll out the fix.  The fix creates tmpfiles in a
> proper system tmpdir, like /tmp.
> 

Techincally the proper system tmpdir is /var/tmp.  /tmp is only there 
for use when booting the system before /var is mounted, and shouldn't be 
used by the general public.

-- 
Brian Mathis
http://www.directedge.com/b/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Problem with svn cat

Posted by Ben Collins-Sussman <su...@collab.net>.
Jason Rust <jr...@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 ''

This is caused by a permissions error.  You probably don't have
permission to write tmpfiles in the current working directory.

>    
> Is there a directory that svn uses for its temporary files that needs to
> be writable by apache for this to work?  

This is a known bug, already fixed, but waiting for a new APR (Apache)
release before we can roll out the fix.  The fix creates tmpfiles in a
proper system tmpdir, like /tmp.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Problem with svn cat

Posted by kf...@collab.net.
Jason Rust <jr...@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))
        continue;
      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);
        }
      else
        {
          *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,
                            NULL,
                            "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
      APR_STATUS_IS_EEXIST.
   
   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))
            continue;
          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
done.

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org