NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
How to build /usr/bin/grep?
Hi folks,
I stumbled across a bug in /usr/bin/grep and noticed that this had been
fixed upstream a long time ago[0], but before creating a PR I wanted to
understand if I'm missing something.
The bug is quite "simple": when using "--devices=skip", grep fails to
match on stdin, because stdin is (wrongly) considered a device. A current
/usr/pkg/bin/ggrep works of course, but /usr/bin/grep appears to be stuck
on version 2.5.1a, probably due to upstream's license change[1] to GPLv3,
making it incompatible with the BSD license.
Anyway, I wanted to see if I can tinker with the sources in
/usr/src/usr.bin/grep somewhat to find out if I can manage to come up with
a fix here, but _before_ even starting to do that I noticed that I could
not reproduce the bug:
$ cd /usr/src/usr.bin/grep/
$ make
$ echo foo | ./grep --devices=skip foo
foo
But why isn't /usr/bin/grep working then? After a whole "./build.sh
distribution" and "./build.sh install=/" the /usr/bin/grep binary sure has
been replaced, and is showing the bug described above - but that binary
differs from all^W most the other grep executables that were created on
the way, see below.
So, I guess my questions are:
* Why is /usr/src/usr.bin/grep/grep different from /usr/bin/grep?
* Why is /usr/bin/grep behaving differently than /rescue/grep?
* Why aren't we just using the FreeBSD grep version 2.6? :-)
Thanks,
Christian.
==== Trying all the grep executables found on my system:
$ for g in ...; do echo "### ${g}"; echo foo | ${g} --devices=skip foo || echo "FAIL"; echo; done
### /usr/bin/grep
FAIL
### /rescue/grep
foo
### /usr/src/usr.bin/grep/grep
foo
### /var/pkgtmp/obj/tools/grep/grep
foo
### /var/pkgtmp/obj/external/gpl2/grep/bin/grep
FAIL
### /var/pkgtmp/obj/destdir.amd64/usr/bin/grep
FAIL
### /var/pkgtmp/obj/destdir.amd64/rescue/grep
foo
### /var/pkgtmp/work/textproc/grep/work/grep-3.11/src/grep
foo
### /usr/pkg/bin/ggrep
foo
### /usr/pkg/bin/bgrep
foo
[0] https://bugzilla.redhat.com/show_bug.cgi?id=818775
[1] https://git.savannah.gnu.org/cgit/grep.git/commit/?id=49177f1
--
BOFH excuse #87:
Password is too complex to decrypt
Home |
Main Index |
Thread Index |
Old Index