Hello Gianluca,

Thank you for sharing the GDB and build output. The link command includes
--wrap=gethostbyname. Since both tests call will_return() before entering
lookup_host(), the breakpoint on __wrap_gethostbyname() leaves alone open
the possibility that the failure occurs during mock setup. The build also
uses /usr/local/include and /usr/local/lib, while Debian's cmocka 1.1.8
packages are installed.

I suggest three checks:

 - Could you share the libcmocka entry from ldd ./tests/test_httpfs? The
-L/usr/local/lib option affects library selection at link time. The ldd
output would show which library the executable resolves at runtime.

 - Could you set breakpoints on both _will_return and lookup_host? If the
assertion occurs before execution reaches lookup_host, that would localize
the failure to mock setup. If execution reaches lookup_host, disassemble
lookup_host should show whether the resolver call targets
__wrap_gethostbyname.

 - For a baseline, I would start with a clean build using Debian's cmocka
1.1.8 headers and library together. If you also test 2.0.0, please use its
headers and library from the same installation and verify the runtime
library path again. This would let us compare the two builds while keeping
the headers and runtime library consistent in each.

Best regards,
Alperen

On Thu, Nov 5, 2026 at 11:54 AM Gianluca Cannata <[email protected]>
wrote:

> Il giorno mer 4 nov 2026 alle ore 19:40 Alperen Erkan
> <[email protected]> ha scritto:
> >
> > Hello Gianluca,
> >
> > I didn’t mean to imply any suspicion. I was simply curious when I saw
> “Red Hat” on your GitHub profile. I have no concerns about your affiliation
> or your contributions.
>
> : )
>
> > Returning to the test failure, could you clarify the following?
> >
> >  - Have you verified that __wrap_gethostbyname() is actually called?
>
> It is not called and I don't understand why. Below the output of gdb.
>
> gdb ./tests/test_httpfs
> GNU gdb (Debian 18.1-2) 18.1
> Copyright (C) 2026 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <
> http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> Type "show copying" and "show warranty" for details.
> This GDB was configured as "i686-gnu".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <https://www.gnu.org/software/gdb/bugs/>.
>
>
> +------------------------------------------------------------------------------+
> | Find the GDB manual online at:
>      |
> | http://www.gnu.org/software/gdb/documentation/.
>       |
> | For help, type "help".
>      |
> | Type "apropos word" to search for commands related to "word".
>     |
>
> +------------------------------------------------------------------------------+
>
> Reading symbols from ./tests/test_httpfs...
> (gdb) b __wrap_gethostbyname
> Breakpoint 1 at 0x1940: file test_httpfs.c, line 56.
> (gdb) run
> Starting program: /home/demo/httpfs/tests/test_httpfs
> [bogus thread id 1 (id 1) exited]
> [bogus thread id 2 (id 2) exited]
> [bogus thread id 3 (id 3) exited]
> [==========] tests: Running 2 test(s).
> [ RUN      ] test_lookup_host_1
> [  ERROR   ] --- count != 0
> [   LINE   ] --- ./src/cmocka.c:1073: error: Failure!
> [  FAILED  ] test_lookup_host_1
> [ RUN      ] test_lookup_host_2
> [  ERROR   ] --- count != 0
> [   LINE   ] --- ./src/cmocka.c:1073: error: Failure!
> [  FAILED  ] test_lookup_host_2
> [==========] tests: 2 test(s) run.
> [  PASSED  ] 0 test(s).
> [  FAILED  ] tests: 2 test(s), listed below:
> [  FAILED  ] test_lookup_host_1
> [  FAILED  ] test_lookup_host_2
>
>  2 FAILED TEST(S)
> [Inferior 1 (bogus thread id 0) exited with code 02]
>
> >  - Which version of cmocka are you using?
>
> pkg-config -modversion cmocka
> 2.0.0
>
> despite having this
>
> apt search cmocka
> cmocka-doc/unstable,now 2.0.2-1 all [installed,automatic]
>   documentation for the CMocka unit testing framework
>
> libcmocka-dev/unstable,now 1.1.8-2+b1 hurd-i386 [installed]
>   development files for the CMocka unit testing framework
>
> libcmocka0/unstable,now 1.1.8-2+b1 hurd-i386 [installed,automatic]
>   library for the CMocka unit testing framework
>
> libcmocka0-dbgsym/unstable 1.1.8-2+b1 hurd-i386
>   debug symbols for libcmocka0
>
> but I think I cloned cmocka 2.0.0 in tmp some time ago. What version
> do you suggest ?
>
> >  - Could you provide a backtrace from the point where the count != 0
> failure occurs?
>
> There's no backtrace from gdb.
>
> >  - Could you share the full linker command used to link test_httpfs,
> captured during a rebuild with V=1?
>
> Here it is:
>
> make V=1 check
> Making check in .
> make[1]: Entering directory '/home/demo/httpfs'
> gcc -DHAVE_CONFIG_H -I. -I/usr/local/include    -g -O2
> -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 -MT httpfs.o -MD -MP -MF
> .deps/httpfs.Tpo -c -o httpfs.o httpfs.c
> mv -f .deps/httpfs.Tpo .deps/httpfs.Po
> gcc -DHAVE_CONFIG_H -I. -I/usr/local/include    -g -O2
> -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 -MT netfs.o -MD -MP -MF
> .deps/netfs.Tpo -c -o netfs.o netfs.c
> mv -f .deps/netfs.Tpo .deps/netfs.Po
> gcc -DHAVE_CONFIG_H -I. -I/usr/local/include    -g -O2
> -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 -MT args.o -MD -MP -MF
> .deps/args.Tpo -c -o args.o args.c
> mv -f .deps/args.Tpo .deps/args.Po
> gcc -DHAVE_CONFIG_H -I. -I/usr/local/include    -g -O2
> -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 -MT http.o -MD -MP -MF
> .deps/http.Tpo -c -o http.o http.c
> mv -f .deps/http.Tpo .deps/http.Po
> gcc -DHAVE_CONFIG_H -I. -I/usr/local/include    -g -O2
> -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 -MT parsehtml.o -MD -MP
> -MF .deps/parsehtml.Tpo -c -o parsehtml.o parsehtml.c
> In file included from parsehtml.c:29:
> /usr/include/libxml2/libxml/SAX.h:18:4: warning: #warning
> "libxml/SAX.h is deprecated" [-Wcpp]
>    18 |   #warning "libxml/SAX.h is deprecated"
>       |    ^~~~~~~
> mv -f .deps/parsehtml.Tpo .deps/parsehtml.Po
> gcc -DHAVE_CONFIG_H -I. -I/usr/local/include    -g -O2
> -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 -MT extract.o -MD -MP
> -MF .deps/extract.Tpo -c -o extract.o extract.c
> mv -f .deps/extract.Tpo .deps/extract.Po
> gcc -DHAVE_CONFIG_H -I. -I/usr/local/include    -g -O2
> -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 -MT node.o -MD -MP -MF
> .deps/node.Tpo -c -o node.o node.c
> mv -f .deps/node.Tpo .deps/node.Po
> gcc  -g -O2 -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2   -o httpfs
> httpfs.o netfs.o args.o http.o parsehtml.o extract.o node.o -lxml2
> -lhurdbugaddr -lnetfs -lfshelp -lpthread -lports -liohelp
> -lshouldbeinlibc -lxml2
> make[1]: Leaving directory '/home/demo/httpfs'
> Making check in tests
> make[1]: Entering directory '/home/demo/httpfs/tests'
> make  test_httpfs
> make[2]: Entering directory '/home/demo/httpfs/tests'
> gcc -DHAVE_CONFIG_H -I. -I..    -I.. -I/usr/local/include -g -O2
> -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 -MT
> test_httpfs-test_httpfs.o -MD -MP -MF
> .deps/test_httpfs-test_httpfs.Tpo -c -o test_httpfs-test_httpfs.o
> `test -f 'test_httpfs.c' || echo './'`test_httpfs.c
> test_httpfs.c: In function '__wrap_gethostbyname':
> test_httpfs.c:59:16: warning: cast to pointer from integer of
> different size [-Wint-to-pointer-cast]
>    59 |         return (struct hostent *)mock();
>       |                ^
> test_httpfs.c:62:12: warning: cast to pointer from integer of
> different size [-Wint-to-pointer-cast]
>    62 |     return (struct hostent *)mock();
>       |            ^
> mv -f .deps/test_httpfs-test_httpfs.Tpo .deps/test_httpfs-test_httpfs.Po
> gcc -DHAVE_CONFIG_H -I. -I..    -I.. -I/usr/local/include -g -O2
> -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 -MT test_httpfs-http.o
> -MD -MP -MF .deps/test_httpfs-http.Tpo -c -o test_httpfs-http.o `test
> -f '../http.c' || echo './'`../http.c
> mv -f .deps/test_httpfs-http.Tpo .deps/test_httpfs-http.Po
> gcc -DHAVE_CONFIG_H -I. -I..    -I.. -I/usr/local/include -g -O2
> -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 -MT
> test_httpfs-parsehtml.o -MD -MP -MF .deps/test_httpfs-parsehtml.Tpo -c
> -o test_httpfs-parsehtml.o `test -f '../parsehtml.c' || echo
> './'`../parsehtml.c
> In file included from ../parsehtml.c:29:
> /usr/include/libxml2/libxml/SAX.h:18:4: warning: #warning
> "libxml/SAX.h is deprecated" [-Wcpp]
>    18 |   #warning "libxml/SAX.h is deprecated"
>       |    ^~~~~~~
> mv -f .deps/test_httpfs-parsehtml.Tpo .deps/test_httpfs-parsehtml.Po
> gcc -DHAVE_CONFIG_H -I. -I..    -I.. -I/usr/local/include -g -O2
> -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 -MT test_httpfs-node.o
> -MD -MP -MF .deps/test_httpfs-node.Tpo -c -o test_httpfs-node.o `test
> -f '../node.c' || echo './'`../node.c
> mv -f .deps/test_httpfs-node.Tpo .deps/test_httpfs-node.Po
> gcc -DHAVE_CONFIG_H -I. -I..    -I.. -I/usr/local/include -g -O2
> -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 -MT
> test_httpfs-extract.o -MD -MP -MF .deps/test_httpfs-extract.Tpo -c -o
> test_httpfs-extract.o `test -f '../extract.c' || echo
> './'`../extract.c
> mv -f .deps/test_httpfs-extract.Tpo .deps/test_httpfs-extract.Po
> gcc -DHAVE_CONFIG_H -I. -I..    -I.. -I/usr/local/include -g -O2
> -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 -MT test_httpfs-netfs.o
> -MD -MP -MF .deps/test_httpfs-netfs.Tpo -c -o test_httpfs-netfs.o
> `test -f '../netfs.c' || echo './'`../netfs.c
> mv -f .deps/test_httpfs-netfs.Tpo .deps/test_httpfs-netfs.Po
> gcc -DHAVE_CONFIG_H -I. -I..    -I.. -I/usr/local/include -g -O2
> -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 -MT test_httpfs-args.o
> -MD -MP -MF .deps/test_httpfs-args.Tpo -c -o test_httpfs-args.o `test
> -f '../args.c' || echo './'`../args.c
> mv -f .deps/test_httpfs-args.Tpo .deps/test_httpfs-args.Po
> gcc -I.. -I/usr/local/include -g -O2 -D_FILE_OFFSET_BITS=64
> -I/usr/include/libxml2 -Wl,--wrap=gethostbyname  -o test_httpfs
> test_httpfs-test_httpfs.o test_httpfs-http.o test_httpfs-parsehtml.o
> test_httpfs-node.o test_httpfs-extract.o test_httpfs-netfs.o
> test_httpfs-args.o -L/usr/local/lib -lcmocka -lmicrohttpd -lxml2
> -lpthread -lnetfs -lfshelp -lports -liohelp -lshouldbeinlibc
> -lhurdbugaddr -lxml2
> make[2]: Leaving directory '/home/demo/httpfs/tests'
> make  check-TESTS
> make[2]: Entering directory '/home/demo/httpfs/tests'
> make[3]: Entering directory '/home/demo/httpfs/tests'
> FAIL: test_httpfs
>
> ============================================================================
> Testsuite summary for httpfs 0.1
>
> ============================================================================
> # TOTAL: 1
> # PASS:  0
> # SKIP:  0
> # XFAIL: 0
> # FAIL:  1
> # XPASS: 0
> # ERROR: 0
>
> ============================================================================
> See tests/test-suite.log for debugging.
>
> ============================================================================
> make[3]: *** [Makefile:733: test-suite.log] Error 1
> make[3]: Leaving directory '/home/demo/httpfs/tests'
> make[2]: *** [Makefile:868: check-TESTS] Error 2
> make[2]: Leaving directory '/home/demo/httpfs/tests'
> make[1]: *** [Makefile:942: check-am] Error 2
> make[1]: Leaving directory '/home/demo/httpfs/tests'
> make: *** [Makefile:496: check-recursive] Error 1
>
> > These details should help us narrow down the cause rather than assume it
> is a linker wrapping or mock queue issue.
>
> Hope I have answered your questions.
>
> > Best regards,
> > Alperen
>
> Sincerely,
>
> Gianluca
>

Reply via email to