Date: Tue, 09 Aug 2011 15:27:30 +0400 From: Test Rat <ttsestt@gmail.com> To: Alexander Best <arundel@freebsd.org> Cc: freebsd-current@freebsd.org, Gabor Kovesdan <gabor@freebsd.org> Subject: Re: issues with bsdgrep and lang/go Message-ID: <864o1qg6zh.fsf@gmail.com> In-Reply-To: <20110809103539.GA79694@freebsd.org> (Alexander Best's message of "Tue, 9 Aug 2011 10:35:39 %2B0000") References: <20110809081842.GA64643@freebsd.org> <86y5z2gakw.fsf@gmail.com> <20110809103539.GA79694@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Alexander Best <arundel@freebsd.org> writes:
> On Tue Aug 9 11, Test Rat wrote:
>> Alexander Best <arundel@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,
%%
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?864o1qg6zh.fsf>
