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

Re: [PATCH] [Issue 1942] svn+ssh should use the port value

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: 2006-02-07 14:45:05 CET

Incorporated Brane's comment on updating the ~/.subversion/config template.
Attaching the new patch.

With regards
Kamesh Jayachandran
[[[
Fix issue #1942, svn+ssh should use the port value.

Patch by: Kamesh Jayachandran <kamesh@collab.net>

* subversion/libsvn_ra_svn/client.c
  (find_tunnel_agent): Modified to accept the apr_uri_t*
  rather than hostinfo so that we can make use of the
  port information available in apr_uri_t.
  This port is given as -p to ssh binary in case available.
  (ra_svn_open): calls this new version of find_tunnel_agent.
* subversion/libsvn_subr/config_file.c
  (svn_config_ensure): Updated comments in ~/.subversion/config
  template to mention about the viablity of hostname:port url style.
]]]

Kamesh Jayachandran wrote:
> Hi Peter,
>
> The re.escape does not seem to work as it escapes all the alphanumeric
> characters like ':', '/'
> I am using string.replace(exp, '+', '\\+')
>
> With regards
> Kamesh Jayachandran
> Peter N. Lundblad wrote:
>> On Tue, 7 Feb 2006, Kamesh Jayachandran wrote:
>>
>>
>>> Finally the problem seems to be improper ssh key configuration in my
>>> box.
>>> I posted the similar cause on 5th December 2005 with a Message-ID:
>>> <4394242D.1040808@collab.net>.
>>>
>>> The only real failure is 'switch_tests.py 16: relocate with prefixes
>>> longer than repo root '
>>>
>>> This test consistently fail for svn+ssh urls even on 1.3.0
>>>
>>> Problem seems to be that expected regex has unescaped '+'. (as in
>>> svn+ssh rather it should be svn\+ssh)
>>>
>>>
>> Bah, thanks for debugging this! That shows how often we run tests under
>> ssh:-(
>>
>>
>>> Will post a patch along with my fix for #1942 after incorporating
>>> Brane's comment on #1942.
>>>
>>>
>> Using re.escape, right?
>>
>> Regards,
>> //Peter
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>

Index: subversion/libsvn_subr/config_file.c
===================================================================
--- subversion/libsvn_subr/config_file.c (revision 18313)
+++ subversion/libsvn_subr/config_file.c (working copy)
@@ -1131,6 +1131,30 @@
         APR_EOL_STR
         "# ssh = $SVN_SSH ssh"
         APR_EOL_STR
+ "### The built-in ssh scheme assumes the ssh tunnel binary to use for"
+ APR_EOL_STR
+ "### tunnelling as 'ssh'. In case you want to access the repository"
+ APR_EOL_STR
+ "### with some other ssh tunnel agent say 'plink' define tunnel "
+ APR_EOL_STR
+ "### as follows,"
+ APR_EOL_STR
+ "# ssh = $SVN_SSH plink"
+ APR_EOL_STR
+ "### If the URL given is of form hostname:port, built-in ssh scheme"
+ APR_EOL_STR
+ "### invokes the default ssh tunnel agent 'ssh' with -p port as 'ssh'"
+ APR_EOL_STR
+ "### understands it. If your ssh tunnel agent does not accept '-p' "
+ APR_EOL_STR
+ "### switch for port or it does not understand URL of the form"
+ APR_EOL_STR
+ "### hostname:port, you should use custom tunnel definition as"
+ APR_EOL_STR
+ "### demonstrated for 'plink' below."
+ APR_EOL_STR
+ "# ssh = $SVN_SSH plink -P port_ssh_server_listens"
+ APR_EOL_STR
         "### If you wanted to define a new 'rsh' scheme, to be used with"
         APR_EOL_STR
         "### 'svn+rsh:' URLs, you could do so as follows:"
Index: subversion/libsvn_ra_svn/client.c
===================================================================
--- subversion/libsvn_ra_svn/client.c (revision 18313)
+++ subversion/libsvn_ra_svn/client.c (working copy)
@@ -438,7 +438,7 @@
 /* --- RA LAYER IMPLEMENTATION --- */
 
 static svn_error_t *find_tunnel_agent(const char *tunnel,
- const char *hostinfo,
+ const apr_uri_t *uri,
                                       const char ***argv,
                                       apr_hash_t *config, apr_pool_t *pool)
 {
@@ -493,9 +493,21 @@
   /* Append the fixed arguments to the result. */
   for (n = 0; cmd_argv[n] != NULL; n++)
     ;
- *argv = apr_palloc(pool, (n + 4) * sizeof(char *));
+ if (uri->port_str != NULL)
+ {
+ *argv = apr_palloc(pool, (n + 6) * sizeof(char *));
+ }
+ else
+ {
+ *argv = apr_palloc(pool, (n + 4) * sizeof(char *));
+ }
   memcpy(*argv, cmd_argv, n * sizeof(char *));
- (*argv)[n++] = svn_path_uri_decode (hostinfo, pool);
+ if (uri->port_str != NULL)
+ {
+ (*argv)[n++] = "-p";
+ (*argv)[n++] = uri->port_str;
+ }
+ (*argv)[n++] = svn_path_uri_decode (uri->hostname, pool);
   (*argv)[n++] = "svnserve";
   (*argv)[n++] = "-t";
   (*argv)[n] = NULL;
@@ -717,8 +729,7 @@
   parse_tunnel (url, &tunnel, pool);
 
   if (tunnel)
- SVN_ERR(find_tunnel_agent(tunnel, uri.hostinfo, &tunnel_argv, config,
- pool));
+ SVN_ERR(find_tunnel_agent(tunnel, &uri, &tunnel_argv, config, pool));
   else
     tunnel_argv = NULL;
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Feb 7 14:47:09 2006

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.