Bug 237873

Summary: Inconsistent behavior between the program and its man page bsdgrep(1)
Product: Base System Reporter: WHR <msl0000023508>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Only Me CC: emaste, kevans, mizhka, msl0000023508
Priority: --- Keywords: patch
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
bsdgrep-fix-manpage.diff
none
bsdgrep-fix-program.diff none

Description WHR 2019-05-13 09:29:02 UTC
The man page bsdgrep(1) says the program won't follow any symbolic links when performing recursive search (with option '-r' or '-R').
But it follows! (try it!)

From the man page:

     -O      If -R is specified, follow symbolic links only if they were
             explicitly listed on the command line.  The default is not to
             follow symbolic links.

...

     -p      If -R is specified, no symbolic links are followed.  This is the
             default.

...

     -R, -r, --recursive
             Recursively search subdirectories listed.

     -S      If -R is specified, all symbolic links are followed.  The default
             is not to follow symbolic links.


This seems indicating that the option '-p' was the default, however the actual default was '-S', according to the source code (https://svnweb.freebsd.org/base/head/usr.bin/grep/grep.c?revision=334806&view=markup#l126).
Comment 1 WHR 2019-05-13 09:31:12 UTC
Created attachment 204352 [details]
bsdgrep-fix-manpage.diff
Comment 2 WHR 2019-05-13 09:31:39 UTC
Created attachment 204353 [details]
bsdgrep-fix-program.diff
Comment 3 WHR 2019-05-13 09:31:53 UTC
The attached 2 patches could fix the program or the man page.