[Bug 237873] Inconsistent behavior between the program and its man page bsdgrep(1)

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 29 Apr 2024 09:02:42 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237873

--- Comment #5 from WHR <msl0000023508@gmail.com> ---
> It seems that the -p option does not work in bsdgrep

By digging futher into the source code, it appears that bsdgrep(1) simply
translates its 'LINK_SKIP' for '-p' into 'FTS_PHYSICAL' flag for fts_open(3);
after that it didn't have any special handling for symbolic links. Thus for any
symbolic link found by fts_read(3) will be followed in function 'procfile'.

It should have cases for 'FTS_SL' and 'FTS_SLNONE' to filter out symbolic links
in case of 'LINK_SKIP', in this 'switch':
https://cgit.freebsd.org/src/tree/usr.bin/grep/util.c?id=e116e040f3091eca914a06dcd0bdd9f1aea23add#n155

-- 
You are receiving this mail because:
You are the assignee for the bug.