Comment 8 for bug 1718668

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Build with -O0 for debugging and -E to check precompiler
gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I../../../../gnulib/tests -I../.. -DIN_LIBVIRT_GNULIB_TESTS=1 -I. -I../../../../gnulib/tests -I../.. -I../../../../gnulib/tests/../.. -I../../gnulib/lib -I../../../../gnulib/tests/../../gnulib/lib -g -O0 -c -o test-getopt-posix.o ../../../../gnulib/tests/test-getopt-posix.c

/bin/bash ../../libtool --tag=CC --preserve-dup-deps --mode=link gcc -g -O0 -o test-getopt-posix test-getopt-posix.o libtests.a ../../gnulib/lib/libgnu.la libtests.a -ldl
libtool: link: gcc -g -O0 -o test-getopt-posix test-getopt-posix.o libtests.a ../../gnulib/lib/.libs/libgnu.a -lutil libtests.a -ldl -pthread

 gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I../../../../gnulib/tests -I../.. -DIN_LIBVIRT_GNULIB_TESTS=1 -I. -I../../../../gnulib/tests -I../.. -I../../../../gnulib/tests/../.. -I../../gnulib/lib -I../../../../gnulib/tests/../../gnulib/lib -g -O0 -E -o test-getopt-posix.E ../../../../gnulib/tests/test-getopt-posix.c

It turns out posixly was always defined to be overwritten as =1 due to the config setting __GETOPT_PREFIX as shown in c#6.

That implies that symptom and casuse is vice versa than I thought.
I expected posixly behavior all the time, but now the getopt_loop changes order.
That might be the .so binding resolved differently or something like that.

Checking the details of that execution, to track the right one we need:
b ../../../../gnulib/tests/test-getopt.h:747
run
c
c
# on the third hit go deeper
b getopt
c
c
p argv[1]
# at the end of the function order will be changed

TBD: check env, check which implementation is used