You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2013/07/27 17:25:38 UTC

svn commit: r1507667 - /subversion/trunk/tools/dist/backport.pl

Author: danielsh
Date: Sat Jul 27 15:25:38 2013
New Revision: 1507667

URL: http://svn.apache.org/r1507667
Log:
backport.pl: fix infinite loop if
~/.subversion/auth/svn.simple/d3c8a345b14f6a1b42251aef8027ab57 didn't exist.

* tools/dist/backport.pl
  ($AVAILID): Error-check open()[1], simplify logic while here.

[1] That's one of the things I _really_ like in Python compared to Perl..

Modified:
    subversion/trunk/tools/dist/backport.pl

Modified: subversion/trunk/tools/dist/backport.pl
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/backport.pl?rev=1507667&r1=1507666&r2=1507667&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport.pl (original)
+++ subversion/trunk/tools/dist/backport.pl Sat Jul 27 15:25:38 2013
@@ -55,13 +55,11 @@ my ($AVAILID) = $ENV{AVAILID} // do {
   local $_ = `$SVNAUTH list 2>/dev/null`;
   ($? == 0) ? (/Auth.*realm: \Q$SVN_A_O_REALM\E\nUsername: (.*)/, $1) : undef
 } // do {
+  local $/; # slurp mode
   my $filename = Digest->new("MD5")->add($SVN_A_O_REALM)->hexdigest;
-  open USERNAME, '<', "$ENV{HOME}/.subversion/auth/svn.simple/$filename";
-  1 until <USERNAME> eq "username\n";
-  <USERNAME>;
-  local $_ = <USERNAME>;
-  chomp;
-  $_
+  open USERNAME, '<', "$ENV{HOME}/.subversion/auth/svn.simple/$filename"
+  and
+  (<USERNAME> =~ /K 8\nusername\nV \d+\n(.*)/, $1)
 }
 // warn "Username for commits (of votes/merges) not found";