For context, gnulib-tests/test-getcwd.c is failing on Mac OS X with exit(7)...
On 30/11/14 05:59, Assaf Gordon wrote: > One more thing regarding AT_FDCWD: > > On Nov 30, 2014, at 0:54, Assaf Gordon <assafgor...@gmail.com> wrote: > >> >> But I did notice this: >> In “m4/getcwd-path-max.m4” there is C code which is very similar to >> ‘test-getcwd.c’. >> BUT, in the m4 file, there’s also a “ifndef”: >> === >> $ grep AT_FDCWD ./glm4/getcwd-path-max.m4 ./gltests/test-getcwd.c >> ./glm4/getcwd-path-max.m4:#ifndef AT_FDCWD >> ./glm4/getcwd-path-max.m4:# define AT_FDCWD 0 >> ./glm4/getcwd-path-max.m4: if (AT_FDCWD || errno == ERANGE || >> errno == ENOENT) >> ./gltests/test-getcwd.c: if (AT_FDCWD || errno == ERANGE || >> errno == ENOENT) >> === >> >> So perhaps it is zero in the M4 test, but non-zero in the ‘make check’ test ? >> >> > > Trying to compile this code (regardless of gnu lib): > === > $ cat 1.c > #include <fcntl.h> > #include <stdio.h> > > int main() > { > printf("AT_FDCWD=%i\n",AT_FDCWD); > return 0; > } > > $ cc -o 1 1.c > ./gltests/1.c:6:27: error: use of undeclared identifier 'AT_FDCWD' > printf("AT_FDCWD=%i\n",AT_FDCWD); > ^ > 1 error generated. > === > > Fails with undefined AT_FDCWD - which hints that the previous Apple-Dev-Kit > files I mentioned which define AT_FDCWD as “-2” are not used by default. Right. You previously said that AT_FDCWD as at: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/sys/fcntl.h Notice the version in the path. I wonder is that to support different versioned builds or something. I.E. as a wild guess I wonder would you have to pass -mmacosx-version-min=10.10 through CFLAGS to get it defined? I.E. ./configure with that in CFLAGS? > So this is supporting the theory that the M4’s “#ifndef AT_FDCWD” is taking > affect, which makes AT_FDCWD=0 in the M4 test, > but not zero in the test-getcwd.c test. Yes there is a mismatch between the original test code depending on AT_FDCWD and this new commit defining it unconditionally: http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commit;h=52c658e9 Eric, I'd guess that we should be adjusting the m4 and test code here to key on a specific define rather than the now unconditionally defined AT_FDCWD? thanks! Pádraig.