Alexander Best <arun...@freebsd.org> writes:

> On Tue Aug  9 11, Test Rat wrote:
>> Alexander Best <arun...@freebsd.org> writes:
>> 
>> [...]
>> > gmake -C 6g install
>> > gmake[1]: Entering directory 
>> > `/usr/ports/lang/go/work/go-20110515/src/cmd/6g'
>> > quietgcc -I"/usr/ports/lang/go/work/go-20110515/include" -ggdb -O2 -c 
>> > "/usr/ports/lang/go/work/go-20110515/src/cmd/6g/list.c"
>> > egrep: : error: .Each undeclared identifier|: error: for each function
>> > it appears|is dangerous, better use|is almost always misused|: In
>> > function |: At top level: |In file included from| from: No such file
>> > or directory
>> 
>> Do you use GREP_OPTIONS?
>
> otaku% type $GREP_OPTIONS
> otaku% echo foo | env -i GREP_OPTIONS= bsdgrep foo
> env: bsdgrep: No such file or directory
> otaku%

Actually, it's lang/go that seems to set the environment variable.

  $ fgrep -r GREP_OPTIONS $(make -V WRKSRC)
  .../src/cmd/gc/mkopnames:export GREP_OPTIONS=""
  .../src/Make.inc:GREP_OPTIONS:=
  .../src/Make.inc:export LANG LC_ALL LC_CTYPE GREP_OPTIONS GREP_COLORS
  .../src/Make.inc: @echo export GREP_OPTIONS="$(GREP_OPTIONS)"
  .../test/run:unset GREP_OPTIONS   # in case user has a non-standard set
  .../doc/devel/weekly.html:* build: clear custom variables like GREP_OPTIONS,

Try below workaround. It also makes empty GREP_COLOR behave like gnugrep(1).

%%
Index: usr.bin/grep/grep.c
===================================================================
--- usr.bin/grep/grep.c (revision 224705)
+++ usr.bin/grep/grep.c (working copy)
@@ -304,7 +304,7 @@ init_color(const char *d)
        char *c;
 
        c = getenv("GREP_COLOR");
-       return (c != NULL ? c : d);
+       return (c != NULL && c[0] != '\0' ? c : d);
 }
 
 int
@@ -360,7 +360,7 @@ main(int argc, char *argv[])
 
        /* support for extra arguments in GREP_OPTIONS */
        eargc = 0;
-       if (eopts != NULL) {
+       if (eopts != NULL && eopts[0] != '\0') {
                char *str;
 
                /* make an estimation of how many extra arguments we have */
@@ -373,6 +373,7 @@ main(int argc, char *argv[])
                eargc = 0;
                /* parse extra arguments */
                while ((str = strsep(&eopts, " ")) != NULL)
+                       if(*str != '\0')
                        eargv[eargc++] = grep_strdup(str);
 
                aargv = (char **)grep_calloc(eargc + argc + 1,
%%
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to