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

[PATCH] Issue 3947 - subversion fails with incorrect home directory/HOME variable

From: Noorul Islam K M <noorul_at_collab.net>
Date: Wed, 06 Jul 2011 16:08:31 +0530

In the issue tracker, Sam said:
=======================================================================
issuing svn --version fails if running under user with non-directory as
home directory. The same applies for incorrectly set $HOME variable.
There is imho also no reason to create $HOME/.subversion/* entries if
executing svn with --version parameter only.

how-to reproduce:
$ HOME=/dev/null svn --version
svn: Can't open file '/dev/null/.subversion/servers': Not a directory

$ HOME=/dev/null svn --version --quiet
svn: Can't open file '/dev/null/.subversion/servers': Not a directory

$ touch x
$ HOME=x svn --version --quiet
svn: Can't open file 'x/.subversion/servers': Not a directory
=======================================================================

Looking at the code I could see that we are falling back to default
configuration if the configuration directory is non-readable. I think we
should do the same in the above case also. Attached is the patch for
this.

Log

[[[

* subversion/svn/main.c
  (main): Fallback to default config if the config directory is
    non-directory. Update comment to reflect the change.

Patch by: Noorul Islam K M <noorul{_AT_}collab.net>
]]]

Thanks and Regards
Noorul

Index: subversion/svn/main.c
===================================================================
--- subversion/svn/main.c (revision 1143254)
+++ subversion/svn/main.c (working copy)
@@ -2367,8 +2367,9 @@
                               opt_state.config_dir, pool);
   if (err)
     {
- /* Fallback to default config if the config directory isn't readable. */
- if (err->apr_err == APR_EACCES)
+ /* Fallback to default config if the config directory isn't
+ readable or is non-directory */
+ if (err->apr_err == APR_EACCES || APR_STATUS_IS_ENOTDIR(err->apr_err))
         {
           svn_handle_warning2(stderr, err, "svn: ");
           svn_error_clear(err);
Received on 2011-07-06 12:41:03 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.