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

configurable svn+ssh remote tunnel commands

From: Stefan Sperling <stsp_at_elego.de>
Date: Wed, 27 Aug 2014 11:38:07 +0200

Apparently people are having trouble in some configurations with
the hardcoded 'svnserve -t' default remote tunnel command.

One problematic case seems to involve running a GUI Subversion
client on a Mac against a server on localhost via svn+ssh.
See #svn chat log at:
http://colabti.org/irclogger/irclogger_log/svn?date=2014-08-26#l248

As far as I understand the situation, apple is shipping an old svnserve
in /usr/bin and the user would prefer running a more recent
/usr/local/bin/svnserve.
Additionally, overriding per-user environment variables like PATH
seems to be a very difficult thing to do. I can't judge if this is
really the case since I don't use MacOS at all.

The user is requesting a config knob to override the default, to be
able to specify a full path to svnserve and add other flags to
svnserve's invocation as desired. This is indeed a fairly trivial
change. Do we want to add this?

Note that, with ssh keys, the server can override the tunnel command
requested by the client, which is another possible workaround.

This is diff is untested, just a proof of concept.

Index: subversion/include/svn_config.h
===================================================================
--- subversion/include/svn_config.h (revision 1618039)
+++ subversion/include/svn_config.h (working copy)
@@ -152,6 +152,8 @@ typedef struct svn_config_t svn_config_t;
 #define SVN_CONFIG_OPTION_SQLITE_EXCLUSIVE_CLIENTS "exclusive-locking-clients"
 /** @since New in 1.9. */
 #define SVN_CONFIG_OPTION_SQLITE_BUSY_TIMEOUT "busy-timeout"
+/** @since New in 1.9. */
+#define SVN_CONFIG_SECTION_TUNNELS_REMOTE "tunnels-remote"
 /** @} */
 
 /** @name Repository conf directory configuration files strings
Index: subversion/libsvn_ra_svn/client.c
===================================================================
--- subversion/libsvn_ra_svn/client.c (revision 1618039)
+++ subversion/libsvn_ra_svn/client.c (working copy)
@@ -436,8 +436,32 @@ static svn_error_t *find_tunnel_agent(const char *
   *argv = apr_palloc(pool, (n + 4) * sizeof(char *));
   memcpy(*argv, cmd_argv, n * sizeof(char *));
   (*argv)[n++] = svn_path_uri_decode(hostinfo, pool);
- (*argv)[n++] = "svnserve";
- (*argv)[n++] = "-t";
+
+ /* Look up the tunnel remote command specification in config. */
+ cfg = config ? svn_hash_gets(config, SVN_CONFIG_CATEGORY_CONFIG) : NULL;
+ svn_config_get(cfg, &val, SVN_CONFIG_SECTION_TUNNELS_REMOTE, tunnel, NULL);
+ if (val)
+ {
+ char **remote_cmd_argv;
+
+ /* Tokenize the command into a list of arguments. */
+ status = apr_tokenize_to_argv(val, &remote_cmd_argv, pool);
+ if (status != APR_SUCCESS)
+ return svn_error_wrap_apr(status, _("Can't tokenize command '%s'"),
+ val);
+ while (*remote_cmd_argv != NULL)
+ {
+ (*argv)[n++] = *remote_cmd_argv;
+ remote_cmd_argv++;
+ }
+ }
+ else
+ {
+ /* Default tunnel remote command. */
+ (*argv)[n++] = "svnserve";
+ (*argv)[n++] = "-t";
+ }
+
   (*argv)[n] = NULL;
 
   return SVN_NO_ERROR;
Index: subversion/libsvn_subr/config_file.c
===================================================================
--- subversion/libsvn_subr/config_file.c (revision 1618039)
+++ subversion/libsvn_subr/config_file.c (working copy)
@@ -1249,6 +1249,13 @@ svn_config_ensure(const char *config_dir, apr_pool
         "### path separator. A single backslash will be treated as an" NL
         "### escape for the following character." NL
         "" NL
+ "### Section for configuring remote tunnel commands." NL
+ "[tunnels-remote]" NL
+ "### Configure the command to be executed at the remote end" NL
+ "### of a given tunnel configured in the [tunnels] section." NL
+ "### The default remote tunnel command is 'svnserve -t'." NL
+ "ssh = /opt/svn/bin/svnserve -t" NL
+ "" NL
         "### Section for configuring miscellaneous Subversion options." NL
         "[miscellany]" NL
         "### Set global-ignores to a set of whitespace-delimited globs" NL
Received on 2014-08-27 11:38:45 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.