Releng 15.0 contains a bug in rc.subr

I found /etc/rc.subr in releng 15.0 contains a line "egrep" , i.e. a bug
Should this not be "grep -E".
Can someone confirm
From manpage of grep(1):
Code:
     -E, --extended-regexp
             Interpret pattern as an extended regular expression (i.e., force
             grep to behave as egrep).
And /usr/bin/egrep exisits at least on stable/15. So it should not be a bug.
 
I found this because of my special setup.
/ is a ufs mount
/usr is a zfs mounted automaticly
But rc scripts are run before /usr is mounted
Even if zfs_load is in loader.conf
Now trying a zfs usr as legacy & adding it manually to fstab ... lets see.
 
At least recent base seem to assume /usr/bin, /usr/sbin, /usr/lib, /usr/libdata and /usr/libexec to be in the same partition and/or dataset as /.
And grep is in /usr/bin, too. Also, even grep lives in /rescure.

Considering above, if usage of egrep in rc.subr is considered to be a bug, using grep is a bug, too.
 
And /usr/bin/egrep exisits at least on stable/15
Not only that, it's the same executable.

Code:
root@williscorto:~ # ll -i /usr/bin/egrep /usr/bin/grep
701188 -r-xr-xr-x  4 root wheel 29624 Dec 25 11:52 /usr/bin/egrep*
701188 -r-xr-xr-x  4 root wheel 29624 Dec 25 11:52 /usr/bin/grep*
(inodes are the same, in other words it's a hard-linked file)
 
  • Like
Reactions: mer
Not only that, it's the same executable.

Code:
root@williscorto:~ # ll -i /usr/bin/egrep /usr/bin/grep
701188 -r-xr-xr-x  4 root wheel 29624 Dec 25 11:52 /usr/bin/egrep*
701188 -r-xr-xr-x  4 root wheel 29624 Dec 25 11:52 /usr/bin/grep*
(inodes are the same, in other words it's a hard-linked file)
Not read the codes, but maybe the same case between ex and vi.
Switching behavior by the executable name (argv[0]), maybe.
Would be the same for fgrep and rgrep.
Code:
% ls -l /usr/bin/*grep
-r-xr-xr-x  15 root wheel  4955  1月 18 10:38 /usr/bin/bzegrep
-r-xr-xr-x  15 root wheel  4955  1月 18 10:38 /usr/bin/bzfgrep
-r-xr-xr-x  15 root wheel  4955  1月 18 10:38 /usr/bin/bzgrep
-r-xr-xr-x   4 root wheel 30888  1月 18 10:38 /usr/bin/egrep
-r-xr-xr-x   4 root wheel 30888  1月 18 10:38 /usr/bin/fgrep
-r-xr-xr-x   4 root wheel 30888  1月 18 10:38 /usr/bin/grep
-r-xr-xr-x  15 root wheel  4955  1月 18 10:38 /usr/bin/lzegrep
-r-xr-xr-x  15 root wheel  4955  1月 18 10:38 /usr/bin/lzfgrep
-r-xr-xr-x  15 root wheel  4955  1月 18 10:38 /usr/bin/lzgrep
lrwxr-xr-x   1 root wheel    15  1月 18 10:38 /usr/bin/pgrep -> ../../bin/pgrep
-r-xr-xr-x   4 root wheel 30888  1月 18 10:38 /usr/bin/rgrep
-r-xr-xr-x  15 root wheel  4955  1月 18 10:38 /usr/bin/xzegrep
-r-xr-xr-x  15 root wheel  4955  1月 18 10:38 /usr/bin/xzfgrep
-r-xr-xr-x  15 root wheel  4955  1月 18 10:38 /usr/bin/xzgrep
-r-xr-xr-x  15 root wheel  4955  1月 18 10:38 /usr/bin/zegrep
-r-xr-xr-x  15 root wheel  4955  1月 18 10:38 /usr/bin/zfgrep
-r-xr-xr-x  15 root wheel  4955  1月 18 10:38 /usr/bin/zgrep
-r-xr-xr-x  15 root wheel  4955  1月 18 10:38 /usr/bin/zstdegrep
-r-xr-xr-x  15 root wheel  4955  1月 18 10:38 /usr/bin/zstdfgrep
-r-xr-xr-x  15 root wheel  4955  1月 18 10:38 /usr/bin/zstdgrep
 
Back
Top