Date: Fri, 4 Sep 2009 10:25:11 -0700 From: Alfred Perlstein <alfred@freebsd.org> To: Gabor Kovesdan <gabor@FreeBSD.org> Cc: FreeBSD developers <hackers@FreeBSD.org> Subject: Re: memchr() strangeness Message-ID: <20090904172511.GI21946@elvis.mu.org> In-Reply-To: <4AA14437.4050507@FreeBSD.org> References: <4AA14437.4050507@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <gabor@FreeBSD.org> [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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090904172511.GI21946>