Skip to contentSkip to conversation

git-svn: fix auth parameter handling on SVN 1.9.0+

PATCH In review Eric Wong 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore

Eric Wong

author
#0 lore raw

PATCH 1/1 git-svn: fix auth parameter handling on SVN 1.9.0+

For users with "store-passwords = no" set in the "[auth]" section of their ~/.subversion/config, SVN 1.9.0+ would fail with the following message when attempting to call svn_auth_set_parameter:

Value is not a string (or undef) at Git/SVN/Ra.pm

Ironically, this breakage was caused by r1553823 in subversion:

"Make svn_auth_set_parameter() usable from Perl bindings."

Since 2007 (602015e0e6ec), git-svn has used a workaround to make svn_auth_set_parameter usable internally. However this workaround breaks under SVN 1.9+, which deals properly with the type mapping and fails to recognize our workaround.

For pre-1.9.0 SVN, we continue to use the existing workaround for the lack of proper type mapping in the bindings.

Tested under subversion 1.6.17 and 1.9.3.

I've also verified r1553823 was not backported to SVN 1.8.x:

BRANCH=http://svn.apache.org/repos/asf/subversion/branches/1.8.x svn log -v $BRANCH/subversion/bindings/swig/core.i

ref: https://bugs.debian.org/797705

---
Thanks to the reporter (Bcc:-ed to protect their privacy) who notified Dair and I of this bug.

Junio: this should also head to maint, thanks.

 perl/Git/SVN/Ra.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
perl/Git/SVN/Ra.pm +6 -2
index 4a499fc..e764696 100644
@@ -81,7 +81,6 @@ sub prepare_config_once {
 	SVN::_Core::svn_config_ensure($config_dir, undef);
 	my ($baton, $callbacks) = SVN::Core::auth_open_helper(_auth_providers);
 	my $config = SVN::Core::config_get_config($config_dir);
-	my $dont_store_passwords = 1;
 	my $conf_t = $config->{'config'};
 
 	no warnings 'once';
@@ -93,9 +92,14 @@ sub prepare_config_once {
 	    $SVN::_Core::SVN_CONFIG_SECTION_AUTH,
 	    $SVN::_Core::SVN_CONFIG_OPTION_STORE_PASSWORDS,
 	    1) == 0) {
+		my $val = '1';
+		if (::compare_svn_version('1.9.0') < 0) { # pre-SVN r1553823
+			my $dont_store_passwords = 1;
+			$val = bless \$dont_store_passwords, "_p_void";
+		}
 		SVN::_Core::svn_auth_set_parameter($baton,
 		    $SVN::_Core::SVN_AUTH_PARAM_DONT_STORE_PASSWORDS,
-		    bless (\$dont_store_passwords, "_p_void"));
+		    $val);
 	}
 	if (SVN::_Core::svn_config_get_bool($conf_t,
 	    $SVN::_Core::SVN_CONFIG_SECTION_AUTH,
Signature · 1 line
EW
Tested-by on v1 1/1
#1 lore raw
Quoted 25 lines · Eric Wong

For users with "store-passwords = no" set in the "[auth]" section of their ~/.subversion/config, SVN 1.9.0+ would fail with the following message when attempting to call svn_auth_set_parameter:

Value is not a string (or undef) at Git/SVN/Ra.pm

Ironically, this breakage was caused by r1553823 in subversion:

"Make svn_auth_set_parameter() usable from Perl bindings."

Since 2007 (602015e0e6ec), git-svn has used a workaround to make svn_auth_set_parameter usable internally. However this workaround breaks under SVN 1.9+, which deals properly with the type mapping and fails to recognize our workaround.

For pre-1.9.0 SVN, we continue to use the existing workaround for the lack of proper type mapping in the bindings.

Tested under subversion 1.6.17 and 1.9.3.

I've also verified r1553823 was not backported to SVN 1.8.x:

BRANCH=http://svn.apache.org/repos/asf/subversion/branches/1.8.x svn log -v $BRANCH/subversion/bindings/swig/core.i

Quoted 8 lines

ref: https://bugs.debian.org/797705

---
Thanks to the reporter (Bcc:-ed to protect their privacy) who notified Dair and I of this bug.

Junio: this should also head to maint, thanks.

Thanks, I confirm it fixed the issue.
You can add the following if you want: