public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
* [Bug] Compat objects not added to CLAR_TEST_PROG
@ 2025-09-05 13:19 Osipov, Michael (IN IT IN)
  2025-09-05 21:37 ` Jeff King
  0 siblings, 1 reply; 7+ messages in thread
From: Osipov, Michael (IN IT IN) @ 2025-09-05 13:19 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 5307 bytes --]

Hi folks,

I am building Git 2.51.0 on HP-UX 11.31, previous releases went 
smoothly. This release now fails with:
> /opt/aCC/bin/aCC -AC99 -AC99 -o t/unit-tests/clar/clar.o -c    -I/opt/ports/include -D_XOPEN_SOURCE=600   -I. -DGIT_HOST_CPU="\"ia64\"" -DUSE_LIBPCRE2 -I/opt/ports/include -DHAVE_ALLOCA_H  -I/opt/ports/include -DUSE_CURL_FOR_IMAP_SEND -I/opt/ports/include -I/etc/opt/ports/ssl/include -I/opt/ports/include -DNO_D_TYPE_IN_DIRENT -DNO_NSEC -DSHA1_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"git-compat-util.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" -DSHA256_BLK -DNO_PTHREADS -DHAVE_LIBCHARSET_H -DHAVE_STRINGS_H -DHAVE_CLOCK_GETTIME -DSNPRINTF_RETURNS_BOGUS -DFREAD_READS_DIRECTORIES -DNO_STRCASESTR -DNO_STRLCPY -DNO_MKDTEMP -DNO_HSTRERROR -DNO_MEMMEM -Icompat/regex -DDEFAULT_EDITOR='"vim"' -DSHELL_PATH='"/bin/sh"' -It/unit-tests t/unit-tests/clar/clar.c
> "t/unit-tests/clar/clar.c", line 90: warning #2047-D: incompatible
>           redefinition of macro "MAX" (declared at line 426 of
>           "/usr/include/sys/param.h")
>   #define MAX(x, y) (((x) > (y)) ? (x) : (y))
>           ^
> 
> "t/unit-tests/clar/clar/sandbox.h", line 138: warning #2223-D: function
>           "mkdtemp" declared implicitly
>         if (mkdtemp(_clar_path) == NULL)
>             ^
> 
> /opt/aCC/bin/aCC -AC99 -AC99  -I/opt/ports/include -D_XOPEN_SOURCE=600   -I. -DGIT_HOST_CPU="\"ia64\"" -DUSE_LIBPCRE2 -I/opt/ports/include -DHAVE_ALLOCA_H  -I/opt/ports/include -DUSE_CURL_FOR_IMAP_SEND -I/opt/ports/include -I/etc/opt/ports/ssl/include -I/opt/ports/include -DNO_D_TYPE_IN_DIRENT -DNO_NSEC -DSHA1_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"git-compat-util.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" -DSHA256_BLK -DNO_PTHREADS -DHAVE_LIBCHARSET_H -DHAVE_STRINGS_H -DHAVE_CLOCK_GETTIME -DSNPRINTF_RETURNS_BOGUS -DFREAD_READS_DIRECTORIES -DNO_STRCASESTR -DNO_STRLCPY -DNO_MKDTEMP -DNO_HSTRERROR -DNO_MEMMEM -Icompat/regex -DDEFAULT_EDITOR='"vim"' -DSHELL_PATH='"/bin/sh"' -o t/unit-tests/bin/unit-tests -L/opt/ports/lib/hpux32   t/unit-tests/u-ctype.o t/unit-tests/u-example-decorate.o t/unit-tests/u-hash.o t/unit-tests/u-hashmap.o t/unit-tests/u-mem-pool.o t/unit-tests/u-oid-array.o t/unit-tests/u-oidmap.o t/unit-tests/u-oidtree.o t/unit-tests/u-prio-queue.o t/unit-tests/u-reftable-basics.o t/unit-tests/u-reftable-block.o t/unit-tests/u-reftable-merged.o t/unit-tests/u-reftable-pq.o t/unit-tests/u-reftable-readwrite.o t/unit-tests/u-reftable-stack.o t/unit-tests/u-reftable-table.o t/unit-tests/u-reftable-tree.o t/unit-tests/u-strbuf.o t/unit-tests/u-strcmp-offset.o t/unit-tests/u-string-list.o t/unit-tests/u-strvec.o t/unit-tests/u-trailer.o t/unit-tests/u-urlmatch-normalization.o t/unit-tests/clar/clar.o t/unit-tests/lib-oid.o t/unit-tests/lib-reftable.o t/unit-tests/unit-test.o common-main.o libgit.a xdiff/lib.a reftable/libreftable.a libgit.a -lpcre2-8 -L/opt/ports/lib/hpux32 -Wl,+b,/opt/ports/lib/hpux32 -L/opt/ports/lib/hpux32 -Wl,+b,/opt/ports/lib/hpux32 -lz -L/opt/ports/lib/hpux32 -Wl,+b,/opt/ports/lib/hpux32 -liconv -lintl -liconv
> ld: Unsatisfied symbol "mkdtemp" in file t/unit-tests/clar/clar.o
> 1 error.
> gmake: *** [Makefile:3938: t/unit-tests/bin/unit-tests] Error 1
> gmake: *** Deleting file 't/unit-tests/bin/unit-tests'

HP-UX' libc does not contain mkdtemp() and the configure script properly 
detects this. NO_MKDTEMP is passed and the gitmkdtemp() function in 
compat/ is compiled. sandbox.h makes use of mkdtemp(), but never 
includes the protoype and the actual object isn't added to the linker path.
I have written a minimalistic patch (see attachment), maybe there is a 
better way. This perfectly works for me now with other warnings:
> "t/unit-tests/clar/clar.c", line 90: warning #2047-D: incompatible
>           redefinition of macro "MAX" (declared at line 426 of
>           "/usr/include/sys/param.h")
>   #define MAX(x, y) (((x) > (y)) ? (x) : (y))
>           ^
> 
> "t/unit-tests/clar/clar/../../../../compat/posix.h", line 68: warning #2047-D:
>           incompatible redefinition of macro "_XOPEN_SOURCE_EXTENDED"
>           (declared at line 260 of "/usr/include/sys/stdsyms.h")
>   #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
>           ^
> 
> "t/unit-tests/clar/clar/../../../../compat/posix.h", line 72: warning #2047-D:
>           incompatible redefinition of macro "_BSD_SOURCE" (declared at line 8
>           of "t/unit-tests/clar/clar.c")
>   #define _BSD_SOURCE 1
>           ^
> 
> "t/unit-tests/clar/clar/../../../../compat/posix.h", line 73: warning #2047-D:
>           incompatible redefinition of macro "_DEFAULT_SOURCE" (declared at
>           line 10 of "t/unit-tests/clar/clar.c")
>   #define _DEFAULT_SOURCE 1
>           ^

Executable in question:> root@deblndw002x:/var/tmp/ports/work
> # nm git-2.51.0.patched/t/unit-tests/bin/unit-tests | grep mkdtemp
> [1052]   |            0|       0|FILE |LOCAL|0|     ABS|compat/mkdtemp.c
> [16407]  |     69365552|     272|FUNC |GLOB |0|   .text|gitmkdtemp

Would be nice to bring this upstream for HP-UX and non-HP-UX of course.

Michael

[-- Attachment #2: git.patch --]
[-- Type: text/plain, Size: 972 bytes --]

diff -u -ur Makefile Makefile
--- Makefile	2025-08-18 02:35:38 +0200
+++ Makefile	2025-09-05 14:34:43 +0200
@@ -3933,7 +3933,7 @@
 $(UNIT_TEST_DIR)/clar/clar.o: $(UNIT_TEST_DIR)/clar.suite
 $(CLAR_TEST_OBJS): $(UNIT_TEST_DIR)/clar-decls.h
 $(CLAR_TEST_OBJS): EXTRA_CPPFLAGS = -I$(UNIT_TEST_DIR)
-$(CLAR_TEST_PROG): $(UNIT_TEST_DIR)/clar.suite $(CLAR_TEST_OBJS) $(GITLIBS) GIT-LDFLAGS
+$(CLAR_TEST_PROG): $(UNIT_TEST_DIR)/clar.suite $(CLAR_TEST_OBJS) $(COMPAT_OBJS) $(GITLIBS) GIT-LDFLAGS
 	$(call mkdir_p_parent_template)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
 
diff -u -ur t/unit-tests/clar/clar/sandbox.h git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h
--- t/unit-tests/clar/clar/sandbox.h	2025-08-18 02:35:38 +0200
+++ t/unit-tests/clar/clar/sandbox.h	2025-09-05 14:10:52 +0200
@@ -2,6 +2,8 @@
 #include <sys/syslimits.h>
 #endif
 
+#include "../../../../compat/posix.h"
+
 static char _clar_path[4096 + 1];
 
 static int

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-09-09 12:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-05 13:19 [Bug] Compat objects not added to CLAR_TEST_PROG Osipov, Michael (IN IT IN)
2025-09-05 21:37 ` Jeff King
2025-09-05 22:12   ` Osipov, Michael (IN IT IN)
2025-09-09  7:45   ` Patrick Steinhardt
2025-09-09  8:00     ` Osipov, Michael (IN IT IN)
2025-09-09 10:15       ` Patrick Steinhardt
2025-09-09 12:07         ` Osipov, Michael (IN IT IN)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox