threads / patch / 44682

patchgit-svn: allow "0" in SVN path components

Subject: [PATCH] git-svn: allow "0" in SVN path components

## tl;dr

2 messages between Dec 12, 2016 and Dec 12, 2016. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Eric Wong· Dec 12, 2016, 11:09 UTC · lore

Blindly checking a path component for falsiness is unwise, as "0" is false to Perl, but a valid pathname component for SVN (or any filesystem).

Found via random code reading.
Signed-off-by: Eric Wong <e@80x24.org>
---
  Junio: this bugfix should go to "maint".
  Will push along with a doc fix for Juergen.
 perl/Git/SVN/Ra.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to perl/Git/SVN/Ra.pm +1 −1
diff --git a/perl/Git/SVN/Ra.pm b/perl/Git/SVN/Ra.pm
index e764696801..56ad9870bc 100644
--- a/perl/Git/SVN/Ra.pm
+++ b/perl/Git/SVN/Ra.pm
@@ -606,7 +606,7 @@ sub minimize_url {
 			my $latest = $ra->get_latest_revnum;
 			$ra->get_log("", $latest, 0, 1, 0, 1, sub {});
 		};
-	} while ($@ && ($c = shift @components));
+	} while ($@ && defined($c = shift @components));
 
 	return canonicalize_url($url);
 }
-- 
EW
Junio C Hamano· Dec 12, 2016, 19:04 UTC · re: Eric Wong · lore

Re: [PATCH] git-svn: allow "0" in SVN path components

Eric Wong <e@80x24.org> writes:
Show 27 quoted lines
> Blindly checking a path component for falsiness is unwise, as
> "0" is false to Perl, but a valid pathname component for SVN
> (or any filesystem).
>
> Found via random code reading.
>
> Signed-off-by: Eric Wong <e@80x24.org>
> ---
>   Junio: this bugfix should go to "maint".
>   Will push along with a doc fix for Juergen.
>
>  perl/Git/SVN/Ra.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/perl/Git/SVN/Ra.pm b/perl/Git/SVN/Ra.pm
> index e764696801..56ad9870bc 100644
> --- a/perl/Git/SVN/Ra.pm
> +++ b/perl/Git/SVN/Ra.pm
> @@ -606,7 +606,7 @@ sub minimize_url {
>  			my $latest = $ra->get_latest_revnum;
>  			$ra->get_log("", $latest, 0, 1, 0, 1, sub {});
>  		};
> -	} while ($@ && ($c = shift @components));
> +	} while ($@ && defined($c = shift @components));
>  
>  	return canonicalize_url($url);
>  }
Makes sense to me.  Thanks.

← back to recent threads