On HP-UX 11.31, I'm getting these link errors: cc -Ae -D_XOPEN_SOURCE=500 -O -g -o test-fdopendir test-fdopendir.o libtests.a ../gllib/libgnu.a libtests.a /usr/ccs/bin/ld: Unsatisfied symbols: program_name (first referenced in ../gllib/libgnu.a(error.o)) (data) gmake[2]: *** [test-fdopendir] Error 1
cc -Ae -D_XOPEN_SOURCE=500 -O -g -o test-fchownat test-fchownat.o libtests.a ../gllib/libgnu.a libtests.a /usr/ccs/bin/ld: Unsatisfied symbols: program_name (first referenced in ../gllib/libgnu.a(error.o)) (data) gmake[2]: *** [test-fchownat] Error 1 cc -Ae -D_XOPEN_SOURCE=500 -O -g -o test-fstatat test-fstatat.o libtests.a ../gllib/libgnu.a libtests.a /usr/ccs/bin/ld: Unsatisfied symbols: program_name (first referenced in ../gllib/libgnu.a(error.o)) (data) gmake[2]: *** [test-fstatat] Error 1 cc -Ae -D_XOPEN_SOURCE=500 -O -g -o test-mkdirat test-mkdirat.o libtests.a ../gllib/libgnu.a libtests.a /usr/ccs/bin/ld: Unsatisfied symbols: program_name (first referenced in ../gllib/libgnu.a(error.o)) (data) gmake[2]: *** [test-mkdirat] Error 1 cc -Ae -D_XOPEN_SOURCE=500 -O -g -o test-openat test-openat.o libtests.a ../gllib/libgnu.a libtests.a /usr/ccs/bin/ld: Unsatisfied symbols: program_name (first referenced in ../gllib/libgnu.a(error.o)) (data) gmake[2]: *** [test-openat] Error 1 cc -Ae -D_XOPEN_SOURCE=500 -O -g -o test-unlinkat test-unlinkat.o libtests.a ../gllib/libgnu.a libtests.a /usr/ccs/bin/ld: Unsatisfied symbols: program_name (first referenced in ../gllib/libgnu.a(error.o)) (data) gmake[2]: *** [test-unlinkat] Error 1 The reason is that these tests depend on the 'openat' module, which depends on 'openat-die', which depends on 'error', which needs the 'program_name' variable. This fixes it: 2011-06-18 Bruno Haible <br...@clisp.org> openat, fdopendir tests: Fix link errors. * modules/openat-tests (Depends-on): Add progname. * modules/fdopendir-tests (Depends-on): Likewise. * tests/test-fchownat.c: Include progname.h. (main): Call set_program_name. * tests/test-fstatat.c: Include progname.h. (main): Call set_program_name. * tests/test-mkdirat.c: Include progname.h. (main): Call set_program_name. * tests/test-openat.c: Include progname.h. (main): Call set_program_name. * tests/test-unlinkat.c: Include progname.h. (main): Call set_program_name. * tests/test-fdopendir.c: Include progname.h. (main): Call set_program_name. --- modules/fdopendir-tests.orig Sat Jun 18 23:03:18 2011 +++ modules/fdopendir-tests Sat Jun 18 22:55:41 2011 @@ -5,6 +5,7 @@ Depends-on: open +progname configure.ac: --- modules/openat-tests.orig Sat Jun 18 23:03:18 2011 +++ modules/openat-tests Sat Jun 18 22:56:00 2011 @@ -19,6 +19,7 @@ ignore-value mgetgroups pathmax +progname usleep stat-time symlink --- tests/test-fchownat.c.orig Sat Jun 18 23:03:18 2011 +++ tests/test-fchownat.c Sat Jun 18 22:55:11 2011 @@ -32,6 +32,7 @@ #include "mgetgroups.h" #include "openat.h" +#include "progname.h" #include "stat-time.h" #include "ignore-value.h" #include "macros.h" @@ -58,11 +59,13 @@ } int -main (void) +main (int argc _GL_UNUSED, char *argv[]) { int result1; /* Skip because of no chown/symlink support. */ int result2; /* Skip because of no lchown support. */ + set_program_name (argv[0]); + /* Clean up any trash from prior testsuite runs. */ ignore_value (system ("rm -rf " BASE "*")); --- tests/test-fdopendir.c.orig Sat Jun 18 23:03:18 2011 +++ tests/test-fdopendir.c Sat Jun 18 22:55:11 2011 @@ -27,14 +27,17 @@ #include <fcntl.h> #include <unistd.h> +#include "progname.h" #include "macros.h" int -main (void) +main (int argc _GL_UNUSED, char *argv[]) { DIR *d; int fd; + set_program_name (argv[0]); + /* A non-directory cannot be turned into a directory stream. */ fd = open ("test-fdopendir.tmp", O_RDONLY | O_CREAT, 0600); ASSERT (0 <= fd); --- tests/test-fstatat.c.orig Sat Jun 18 23:03:18 2011 +++ tests/test-fstatat.c Sat Jun 18 22:55:11 2011 @@ -32,6 +32,7 @@ #include "openat.h" #include "pathmax.h" +#include "progname.h" #include "same-inode.h" #include "ignore-value.h" #include "macros.h" @@ -58,10 +59,12 @@ } int -main (void) +main (int argc _GL_UNUSED, char *argv[]) { int result; + set_program_name (argv[0]); + /* Remove any leftovers from a previous partial run. */ ignore_value (system ("rm -rf " BASE "*")); --- tests/test-mkdirat.c.orig Sat Jun 18 23:03:18 2011 +++ tests/test-mkdirat.c Sat Jun 18 22:55:11 2011 @@ -30,6 +30,7 @@ #include <stdlib.h> #include <unistd.h> +#include "progname.h" #include "ignore-value.h" #include "macros.h" @@ -47,10 +48,12 @@ } int -main (void) +main (int argc _GL_UNUSED, char *argv[]) { int result; + set_program_name (argv[0]); + /* Clean up any trash from prior testsuite runs. */ ignore_value (system ("rm -rf " BASE "*")); --- tests/test-openat.c.orig Sat Jun 18 23:03:18 2011 +++ tests/test-openat.c Sat Jun 18 22:55:12 2011 @@ -29,6 +29,7 @@ #include <stdio.h> #include <unistd.h> +#include "progname.h" #include "macros.h" #define BASE "test-openat.t" @@ -58,10 +59,12 @@ } int -main (void) +main (int argc _GL_UNUSED, char *argv[]) { int result; + set_program_name (argv[0]); + /* Basic checks. */ result = test_open (do_open, false); dfd = open (".", O_RDONLY); --- tests/test-unlinkat.c.orig Sat Jun 18 23:03:18 2011 +++ tests/test-unlinkat.c Sat Jun 18 22:55:12 2011 @@ -30,6 +30,7 @@ #include <stdlib.h> #include <sys/stat.h> +#include "progname.h" #include "unlinkdir.h" #include "ignore-value.h" #include "macros.h" @@ -56,12 +57,14 @@ } int -main (void) +main (int argc _GL_UNUSED, char *argv[]) { /* FIXME: Add tests of fd other than ".". */ int result1; int result2; + set_program_name (argv[0]); + /* Remove any leftovers from a previous partial run. */ ignore_value (system ("rm -rf " BASE "*")); -- In memoriam Mona Mahmudnizhad <http://en.wikipedia.org/wiki/Mona_Mahmudnizhad>