From owner-freebsd-current@FreeBSD.ORG Tue Aug 9 18:22:16 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 68BD61065672; Tue, 9 Aug 2011 18:22:16 +0000 (UTC) Date: Tue, 9 Aug 2011 18:22:16 +0000 From: Alexander Best To: Test Rat Message-ID: <20110809182216.GA51500@freebsd.org> References: <20110809081842.GA64643@freebsd.org> <86y5z2gakw.fsf@gmail.com> <20110809103539.GA79694@freebsd.org> <864o1qg6zh.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <864o1qg6zh.fsf@gmail.com> Cc: freebsd-current@freebsd.org, Gabor Kovesdan Subject: Re: issues with bsdgrep and lang/go X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 18:22:16 -0000 On Tue Aug 9 11, Test Rat wrote: > Alexander Best writes: > > > On Tue Aug 9 11, Test Rat wrote: > >> Alexander Best 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). thanks a bunch. after applying your patch lang/go builds without any issues! :) cheers. alex > > %% > 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, > %%