> Hi,
> 
> Andrew Schulman wrote:
> > I'm building argp for Cygwin. The build succeeds, and all of the tests
> > pass except for one, test-argp-2.sh.
> 
> For me, on Cygwin, this test passes.
> 
> > The contents of test-suite.log are below.
> > ...
> > The error is pretty trivial, and I think it's incorrect. If I
> > understand the source in lib/argp-help.c correctly
> > (https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/argp-help.c;h=e5baee2ca89e867000ac7ac0e7fbd8b5a14aa34b;hb=HEAD#l1795),
> > I think argp isn't supposed to print the "Report bugs to" message if
> > argp_program_bug_address is undefined.
> 
> argp_program_bug_address is not undefined. If it were undefined, the
> program would not link. The code tests whether its value is NULL or non-NULL.

Right, thank you. It's been a while since I looked at C.

> In fact, it's a global variable defined in test-argp.c, and it has a non-NULL
> value.
> 
> Something must be wrong with the way you build your Cygwin binaries.
> What command lines are shown when you do
>   $ rm -f test-argp.o
>   $ make test-argp.o V=1
> 
> ?

```
$ make test-argp.o V=1
gcc -DHAVE_CONFIG_H -I.
-I/home/andrew/dev/cygwin/libargp/libargp-20230708-1.x86_64/src/gnulib/argp/gltests
-DGNULIB_STRICT_CHECKING=1 -I.
-I/home/andrew/dev/cygwin/libargp/libargp-20230708-1.x86_64/src/gnulib/argp/gltests
-I..
-I/home/andrew/dev/cygwin/libargp/libargp-20230708-1.x86_64/src/gnulib/argp/gltests/..
-I../gllib
-I/home/andrew/dev/cygwin/libargp/libargp-20230708-1.x86_64/src/gnulib/argp/gltests/../gllib
-Wno-error -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-fstack-protector-strong --param=ssp-buffer-size=4
-fdebug-prefix-map=/home/andrew/dev/cygwin/libargp/libargp-20230708-1.x86_64/build=/usr/src/debug/libargp-20230708-1
-fdebug-prefix-map=/home/andrew/dev/cygwin/libargp/libargp-20230708-1.x86_64/src/gnulib=/usr/src/debug/libargp-20230708-1
-MT test-argp.o -MD -MP -MF .deps/test-argp.Tpo -c -o test-argp.o
/home/andrew/dev/cygwin/libargp/libargp-20230708-1.x86_64/src/gnulib/argp/gltests/test-argp.c
mv -f .deps/test-argp.Tpo .deps/test-argp.Po
```

We use a few patches
(https://cygwin.com/git-cygwin-packages/?p=git/cygwin-packages/libargp.git;a=tree)
to package argp as a shared libargp for Cygwin. Since the test passes for you, I
went back and reviewed them and found an error in one of them,
libargp-optional-variables.patch. It makes argp's global variables work in a
Windows shared library, but it didn't include argp_program_bug_address. I fixed
that, and argp passes all of the tests now.

So hooray for automated testing! It found a problem. And thanks for your help.

Andrew


Reply via email to