[PATCH] submodule: fix quoting in relative_path()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit caca2c1 (submodule: drop the top-level requirement) introduced a
relative_path helper but does not quote $curdir when it is stripped from
the front of a target path.  In this particular case this should be safe
even with special characters because we only do this after checking that
$target begins with "$curdir/" which is quoted correctly, but we should
quote the variable to be certain that there is not some obscure case
where we this could strip more or less than we want.

Signed-off-by: John Keeping <john@xxxxxxxxxxxxx>
---
On Fri, Apr 19, 2013 at 02:03:14PM -0700, Junio C Hamano wrote:
> Johannes Sixt <j6t@xxxxxxxx> writes:
> 
> > Why not just replace the six-liner by this one-liner:
> >
> > 		target=${target#"$curdir"/}
> 
> Simple enough ;-)

This seems to have arrived on next without this fix, so here's a patch
on top.

 git-submodule.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 0eee703..db9f260 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -127,7 +127,7 @@ relative_path ()
 	do
 		case "$target" in
 		"$curdir/"*)
-			target=${target#$curdir/}
+			target=${target#"$curdir"/}
 			break
 			;;
 		esac
-- 
1.8.2.1.715.gb260f47

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]