From owner-freebsd-hackers@FreeBSD.ORG Fri Sep 4 17:25:11 2009 Return-Path: Delivered-To: hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC1A61065672 for ; Fri, 4 Sep 2009 17:25:11 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id CD0148FC25 for ; Fri, 4 Sep 2009 17:25:11 +0000 (UTC) Received: by elvis.mu.org (Postfix, from userid 1192) id 9F02E1A3CE4; Fri, 4 Sep 2009 10:25:11 -0700 (PDT) Date: Fri, 4 Sep 2009 10:25:11 -0700 From: Alfred Perlstein To: Gabor Kovesdan Message-ID: <20090904172511.GI21946@elvis.mu.org> References: <4AA14437.4050507@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4AA14437.4050507@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: FreeBSD developers Subject: Re: memchr() strangeness X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Sep 2009 17:25:11 -0000 Moved to -hackers. Gabor, can you please make a smaller program to exhibit this behavior? (not just the error line) I will be glad to help out. -Alfred * Gabor Kovesdan [090904 10:04] wrote: > Hello, > > having returned from vacation, I'm trying to track down the (hopefully) > last critical bug in BSDL grep I worked on the last summer. The binary > file detection is implemented as follows: > f->binary = memchr(binbuf, (filebehave != FILE_GZIP) ? '\0' : '\200', i > - 1) != NULL; > > There's some strange with this. In my normal environment it works fine: > server# echo foobar | ./grep -v '^ *+' > foobar > > But in a chroot environment the binary detection is broken: > # echo foobar | grep -v '^ *+' > foobar > Binary file (standard input) matches > > I don't know where things go bad. I've tried to print out the content of > the buffer and the buffer length and they are the same but somehow in > the chrooted environment this sets f->binary to true. > Any suggestions? > > Thanks in advance, > > -- > Gabor Kovesdan > FreeBSD Volunteer > > EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org > WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org > > -- > This mail is for the internal use of the FreeBSD project committers, > and as such is private. This mail may not be published or forwarded > outside the FreeBSD committers' group or disclosed to other unauthorised > parties without the explicit permission of the author(s). -- - Alfred Perlstein .- AMA, VMOA #5191, 03 vmax, 92 gs500, 85 ch250 .- FreeBSD committer