memchr() strangeness
Max Laier
max at love2party.net
Fri Sep 4 18:14:26 UTC 2009
On Friday 04 September 2009 19:43:37 Gabor Kovesdan wrote:
> Alfred Perlstein escribió:
> > Moved to -hackers.
>
> Thanks, this was my original intention.
>
> > Gabor, can you please make a smaller program to exhibit this behavior?
> > (not just the error line)
> >
> > I will be glad to help out.
>
> After reading your mail, I've made a small program:
>
> #include <stdbool.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
>
> int
> main(int argc, char *argv[])
> {
> bool foo;
>
> foo = memchr(argv[1], '\0', strlen(argv[1]));
> if (foo)
> fprintf(stderr, "Ooooops!\n");
>
> }
>
> And it works correctly, so actually grep fails somewhere else but it's
> very strange why it behaves differently jailed (or chrooted). Once
> submitted it for a portbuild test because it had been working correctly
> for me on a production system and then it failed on the cluster because
> the package build run jailed. And then I created a jail and in fact I
> could reproduce this but only in the jail.
LC_* set to a locale not available in the jail? Just a wild guess.
--
/"\ Best regards, | mlaier at freebsd.org
\ / Max Laier | ICQ #67774661
X http://pf4freebsd.love2party.net/ | mlaier at EFnet
/ \ ASCII Ribbon Campaign | Against HTML Mail and News
More information about the freebsd-hackers
mailing list