Re: [PATCH 4/4] attr.c: fix matching "subdir" without the trailing slash

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

 



On Mon, Mar 25, 2013 at 1:05 PM, Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote:
> The story goes back to 94bc671 (Add directory pattern matching to
> attributes - 2012-12-08). Before this commit, directories are passed
> to path_matches without the trailing slash. This is fine for matching
> pattern "subdir" with "foo/subdir".
>
> Patterns like "subdir/" (i.e. match _directory_ subdir) won't work
> though. So paths are now passed to path_matches with the trailing
> slash (i.e. "subdir/"). The trailing slash is used as the directory
> indicator (similar to dtype in exclude case). This makes pattern
> "subdir/" match directory "subdir/". Pattern "subdir" no longer match
> subdir, which is now "subdir/".
>
> As the trailing slash in pathname is the directory indicator, we do
> not need to keep it in the pathname for matching. The trailing slash
> should be turned to dtype "DT_DIR" and stripped out of pathname. This
> keeps the code pattern similar to exclude.

On second thought, maybe we should not pass path "subdir/" at all.
Instead we create a fake dtype based on the trailing slash and pass it
down to attr.c:fill() -> path_matches(), just like how
last_exclude_matching_from_list() is called.
-- 
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]