Re: [PATCH 1/2] Fixes _is_git

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

 



2015-02-02 12:24 UTC-05:00, Remi Rampin <remirampin@xxxxxxxxx>:
>>  proc _is_git {path} {
>> +       if {[file isfile $path]} {
>> +               set fp [open $path r]
>> +               gets $fp line
>> +               close $fp
>> +               if {[regexp "^gitdir: (.+)$" $line line link_target]} {

2015-02-03 3:44 UTC-05:00, Chris Packham <judge.packham@xxxxxxxxx>:
> It might be simpler to use one of the 'string' commands e.g. string
> wordend "gitdir: " I also suspect the string functions would be faster
> than regexp but that probably doesn't matter.

I want to check that the file actually begins with "gitdir: " and then
extract the path, so I'm not sure if using string functions is that
simple/fast.

>> +                       return [_is_git [file join [file dirname $path] $link_target]]

> Do we want to avoid pathological cases of infinite recursion? Someone
> would have to maliciously create such a situation.

Limiting the recursion is very simple, but I'm not sure people are
supposed to stumble on that. More importantly this probably calls for a
different error message, thus a new error result that I am not ready to
implement. But it could be another patch.
But I suppose I can add a simple "return 0" limit to the recursion if
needed, let me know.
--
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]