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

Admin directory seperation

From: Alan <alan_at_alan2.com>
Date: 2003-11-25 04:12:01 CET


So im trying to hack subversion, and im getting myself into trouble, so I
thought I would ask people who actually know to see if I get any help. Please
tell me if my cause if futile or it has allready been discussed...

The thing that im trying to accomplish is essentially moving the .svn folders
into a separate dirctory tree, so they don't get in the way, and I can protect
them from prying eyes.

My scheme for doing this was to define an environmental variable
SVN_ADMDIR_PATH, which if defined, maps the root into that directory.
I would then intercept the path to the admin files in v_extend_with_adm_name
(adm_files.c), and rewrite it to the new path.
For example, if my working copy is in /home/files, and SVN_ADMDIR_PATH is
defined to /home/files_adm, then the .svn folders are created in

I know this isnt an ideal solution, but I believe it will work for me.

So I hacked in the patch below, but it caused all kinds of problems.
It seems that other parts of subversion either assume that the paths are
relative, or assume something about the length of the path. The problem which
has me stuck is in log_do_file_readonly (libsvn_wc/log.c)

My SVN_ADMDIR_PATH is set to "/usr/tvs/admdir", and Im running a checkout
command with svn+ssh.
I get these messages: (Full_path & path are my message)
Path: 'packages/apache' -> '/usr/tvs/admdir/usr/tvs/packages/apache'
svn: Problem running log
svn: in directory 'packages/apache'
svn: start_handler: error processing command 'readonly' in 'packages/apache'
svn: No such file or directory
svn: svn_io_set_file_read_only: failed to set file
'packages/apache/usr/tvs/packages/apache/props/name.svn-work' read-only

Essentially, the "name" argument to log_do_file_readonly is coming in in a
mangled form. My path translation routines seem to be working as I want them (in
the Path: line)
It is coming in as "usr/tvs/packages/apache/props/name.svn-work"
But it should be more like
It is somehow losing the "/usr/tvs/admdir/", which just happens to be the length
of the path name "/packages/apache", the length of the chopped section is
definitely related to the length of the path being checked out, but Im not sure
if it is a 1 to 1 relationship.

I am unable to find the source of this path mangling because it comes in through
the log handler, and I don't know how the handler stuff works, or even how to
start looking.

Does anybody happen to have any knowledge about where this mangling is taking
place? Or does anybody know for sure that this happens all over the place and I
should just give up?

Any help would be appriciated,

--- subversion-0.33.1.dist/subversion/libsvn_wc/adm_files.c Tue Nov 11
17:21:17 2003
+++ subversion-0.33.1/subversion/libsvn_wc/adm_files.c Mon Nov 24 16:44:40 2003
@@ -23,6 +23,7 @@

 #include <stdarg.h>
+#include <sys/param.h>
 #include <assert.h>
 #include <apr_pools.h>
 #include <apr_hash.h>
@@ -66,10 +67,27 @@
                         va_list ap)
   const char *this;
- /* Tack on the administrative subdirectory. */
- path = svn_path_join (path, SVN_WC_ADM_DIR_NAME, pool);
+printf("Path: '%s' ", path);
+ this = getenv("SVN_ADMDIR_PATH");
+ if(this == NULL) {
+ /* Tack on the administrative subdirectory. */
+ path = svn_path_join (path, SVN_WC_ADM_DIR_NAME, pool);
+ } else {
+ /* remap the admin subdir to a better place. */
+ if(path[0] != '/') {
+ /* path is not absolute, make it so. This is prolly a crappy way to do it
+ char pwd_buf[MAXPATHLEN];
+ getwd(pwd_buf);
+ /* pwd_buf+1 to prevent formation of an absolute path. */
+ path = svn_path_join (pwd_buf+1, path, pool);
+ path = svn_path_join (path, SVN_WC_ADM_DIR_NAME, pool);
+ }
+ /* path is now absolute */
+ path = svn_path_join (this, path, pool);
+ }
+printf(" -> '%s'\n", path);
   /* If this is a tmp file, name it into the tmp area. */
   if (use_tmp)
     path = svn_path_join (path, SVN_WC__ADM_TMP, pool);

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 25 04:14:58 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.