Re: [PATCH 3/4] attr.c::path_matches(): special case paths that end with a slash

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

 



On Wed, Mar 27, 2013 at 4:33 AM, Jeff King <peff@xxxxxxxx> wrote:
> Hmm. match_pathname does have this:
>
>         /*
>          * baselen does not count the trailing slash. base[] may or
>          * may not end with a trailing slash though.
>          */
>         if (pathlen < baselen + 1 ||
>             (baselen && pathname[baselen] != '/') ||
>             strncmp_icase(pathname, base, baselen))
>                 return 0;
>
> which seems to imply that the trailing slash is important here, and that
> we should not drop it when passing the path to match_pathname. I'm
> still trying to figure out exactly what it is that the extra slash check
> is for, and whether it might not have the same problem.

The "may not end with a trailing slash" can only happen when baselen
== 0. And that rule is documented in code, at this line in
last_exclude_matching_from_list:

assert(x->baselen == 0 || x->base[x->baselen - 1] == '/');
-- 
Duy
--
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]