Re: [PATCHv3 2/2] git submodule: Fix adding of submodules at paths with ./, .. and //

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

 



Johannes Sixt <j.sixt@xxxxxxxxxxxxx> writes:

> Michael J Gruber schrieb:
>> +	# normalize path:
>> +	# multiple //; leading ./; /./; /../; trailing /
>> +	path=$(printf '%s/\n' "$path" |
>> +		sed -e '
>> +			s|//*|/|g
>> +			s|^\(\./\)*||
>> +			s|/\./|/|g
>> +			:start
>> +			s|\([^/]*\)/\.\./||g
>
> Sorry to say: not yet. This turns "a/b/c/d/../../../d" into "a/b/c/d"
> instead of "a/d". Drop the 'g'.
>
> Once this is fixed, I have to ask what should happen with path names like
> "../a/b", "../../a/b"? Should there be a warning or error?
>
> Other than that, this expression works on AIX 4.3.3! Note in particular
> that '\n' in the printf format string is essential!
>
>> +			tstart
>> +			s|/*$||
>> +		')

At some point you should wonder if all of this complication is worth it,
or it makes sense to reject when you see // or /\.\./ in the input.

--
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]

  Powered by Linux