Hello Richard, Simon Josefsson reported on 2008-12-09: > test-flock.c:90: assertion failed, errno = 0 > Abort trap > espresso:~/daily/gnulib/dummy-0/gltests jas$ > > Removing the line with the abort() call gives: > > test-flock.c:89: assertion failed, errno = 0 > test-flock.c:90: assertion failed, errno = 0 > test-flock.c:91: assertion failed, errno = 0 > test-flock.c:92: assertion failed, errno = 0 > test-flock.c:93: assertion failed, errno = 0 > test-flock.c:94: assertion failed, errno = 0 > test-flock.c:96: assertion failed, errno = 9 > > The code reads: > > /* Some impossible operation codes which should never be accepted. */ > ASSERT (flock (fd, LOCK_SH | LOCK_EX) == -1); > ASSERT (errno == EINVAL); > ASSERT (flock (fd, LOCK_SH | LOCK_UN) == -1); > ASSERT (errno == EINVAL); > ASSERT (flock (fd, LOCK_EX | LOCK_UN) == -1); > ASSERT (errno == EINVAL); > ASSERT (flock (fd, 0) == -1); > ASSERT (errno == EINVAL); > > All but the next-to-last statement gives an assertion failure. It seems > all other flock call returns 0. Errno 9 is EBADF on this machine. > > Maybe these particular self-tests aren't that useful? I'm not sure it > is worth replacing the flock function just to fix these corner cases > that aren't used by real applications. Thoughts?
I'm seeing this as well, on MacOS X 10.5: ../../gltests/test-flock.c:90: assertion failed, errno = 0 /bin/sh: line 1: 93300 Abort trap ... FAIL: test-flock $ grep -i flock config.status S["HAVE_FLOCK"]="1" S["GNULIB_FLOCK"]="1" D["HAVE_FLOCKFILE"]=" 1" D["HAVE_FLOCK"]=" 1" D["HAVE_DECL_FLOCKFILE"]=" 1" D["HAVE_FLOCKFILE"]=" 1" D["HAVE_FLOCKFILE"]=" 1" This is the only gnulib test that fails on MacOS X 10.5. If you think that rejecting invalid bit combinations in the flags argument of flock() is a requirement, what's missing is to enhance the module so as to provide a wrapper around that system's flock() function, with this checking. If you think the opposite, what's needed is to comment out these checks from the unit test. So that it becomes clear to everyone that one cannot count upon the rejection of invalid flags. Bruno