{"thread":{"id":"64096","subject":"[Bug] Compat objects not added to CLAR_TEST_PROG","startedAt":"2025-09-05T13:19:54Z","lastAt":"2025-09-09T12:07:39Z","messageCount":7,"participants":["Osipov, Michael (IN IT IN)","Jeff King","Patrick Steinhardt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"525627","messageId":"d8d4266e-838c-488e-9aaf-4a1be0169795@innomotics.com","threadId":"64096","inReplyTo":null,"subject":"[Bug] Compat objects not added to CLAR_TEST_PROG","fromName":"Osipov, Michael (IN IT IN)","fromEmail":"michael.osipov@innomotics.com","sentAt":"2025-09-05T13:19:50Z","receivedAt":"2025-09-05T13:19:54Z","isPatch":false,"sender":{"key":"michael.osipov@innomotics.com","avatar":null},"body":"Hi folks,\n\nI am building Git 2.51.0 on HP-UX 11.31, previous releases went \nsmoothly. This release now fails with:\n> /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\n> \"t/unit-tests/clar/clar.c\", line 90: warning #2047-D: incompatible\n>           redefinition of macro \"MAX\" (declared at line 426 of\n>           \"/usr/include/sys/param.h\")\n>   #define MAX(x, y) (((x) > (y)) ? (x) : (y))\n>           ^\n> \n> \"t/unit-tests/clar/clar/sandbox.h\", line 138: warning #2223-D: function\n>           \"mkdtemp\" declared implicitly\n>         if (mkdtemp(_clar_path) == NULL)\n>             ^\n> \n> /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\n> ld: Unsatisfied symbol \"mkdtemp\" in file t/unit-tests/clar/clar.o\n> 1 error.\n> gmake: *** [Makefile:3938: t/unit-tests/bin/unit-tests] Error 1\n> gmake: *** Deleting file 't/unit-tests/bin/unit-tests'\n\nHP-UX' libc does not contain mkdtemp() and the configure script properly \ndetects this. NO_MKDTEMP is passed and the gitmkdtemp() function in \ncompat/ is compiled. sandbox.h makes use of mkdtemp(), but never \nincludes the protoype and the actual object isn't added to the linker path.\nI have written a minimalistic patch (see attachment), maybe there is a \nbetter way. This perfectly works for me now with other warnings:\n> \"t/unit-tests/clar/clar.c\", line 90: warning #2047-D: incompatible\n>           redefinition of macro \"MAX\" (declared at line 426 of\n>           \"/usr/include/sys/param.h\")\n>   #define MAX(x, y) (((x) > (y)) ? (x) : (y))\n>           ^\n> \n> \"t/unit-tests/clar/clar/../../../../compat/posix.h\", line 68: warning #2047-D:\n>           incompatible redefinition of macro \"_XOPEN_SOURCE_EXTENDED\"\n>           (declared at line 260 of \"/usr/include/sys/stdsyms.h\")\n>   #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */\n>           ^\n> \n> \"t/unit-tests/clar/clar/../../../../compat/posix.h\", line 72: warning #2047-D:\n>           incompatible redefinition of macro \"_BSD_SOURCE\" (declared at line 8\n>           of \"t/unit-tests/clar/clar.c\")\n>   #define _BSD_SOURCE 1\n>           ^\n> \n> \"t/unit-tests/clar/clar/../../../../compat/posix.h\", line 73: warning #2047-D:\n>           incompatible redefinition of macro \"_DEFAULT_SOURCE\" (declared at\n>           line 10 of \"t/unit-tests/clar/clar.c\")\n>   #define _DEFAULT_SOURCE 1\n>           ^\n\nExecutable in question:> root@deblndw002x:/var/tmp/ports/work\n> # nm git-2.51.0.patched/t/unit-tests/bin/unit-tests | grep mkdtemp\n> [1052]   |            0|       0|FILE |LOCAL|0|     ABS|compat/mkdtemp.c\n> [16407]  |     69365552|     272|FUNC |GLOB |0|   .text|gitmkdtemp\n\nWould be nice to bring this upstream for HP-UX and non-HP-UX of course.\n\nMichael\n\n\ndiff -u -ur Makefile Makefile\n--- Makefile\t2025-08-18 02:35:38 +0200\n+++ Makefile\t2025-09-05 14:34:43 +0200\n@@ -3933,7 +3933,7 @@\n $(UNIT_TEST_DIR)/clar/clar.o: $(UNIT_TEST_DIR)/clar.suite\n $(CLAR_TEST_OBJS): $(UNIT_TEST_DIR)/clar-decls.h\n $(CLAR_TEST_OBJS): EXTRA_CPPFLAGS = -I$(UNIT_TEST_DIR)\n-$(CLAR_TEST_PROG): $(UNIT_TEST_DIR)/clar.suite $(CLAR_TEST_OBJS) $(GITLIBS) GIT-LDFLAGS\n+$(CLAR_TEST_PROG): $(UNIT_TEST_DIR)/clar.suite $(CLAR_TEST_OBJS) $(COMPAT_OBJS) $(GITLIBS) GIT-LDFLAGS\n \t$(call mkdir_p_parent_template)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)\n \ndiff -u -ur t/unit-tests/clar/clar/sandbox.h git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h\n--- t/unit-tests/clar/clar/sandbox.h\t2025-08-18 02:35:38 +0200\n+++ t/unit-tests/clar/clar/sandbox.h\t2025-09-05 14:10:52 +0200\n@@ -2,6 +2,8 @@\n #include <sys/syslimits.h>\n #endif\n \n+#include \"../../../../compat/posix.h\"\n+\n static char _clar_path[4096 + 1];\n \n static int\n"},{"id":"525677","messageId":"20250905213708.GB612697@coredump.intra.peff.net","threadId":"64096","inReplyTo":"d8d4266e-838c-488e-9aaf-4a1be0169795@innomotics.com","subject":"Re: [Bug] Compat objects not added to CLAR_TEST_PROG","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2025-09-05T21:37:08Z","receivedAt":"2025-09-05T21:37:11Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"[+cc pks for clar portability]\n\nOn Fri, Sep 05, 2025 at 03:19:50PM +0200, Osipov, Michael (IN IT IN) wrote:\n\n> I am building Git 2.51.0 on HP-UX 11.31, previous releases went smoothly.\n\nNeat, today I learned HP-UX is still alive and kicking. :)\n\nHalf of your patch makes sense to me, but I'm puzzled by the other half.\nThis:\n\n> diff -u -ur t/unit-tests/clar/clar/sandbox.h git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h\n> --- t/unit-tests/clar/clar/sandbox.h\t2025-08-18 02:35:38 +0200\n> +++ t/unit-tests/clar/clar/sandbox.h\t2025-09-05 14:10:52 +0200\n> @@ -2,6 +2,8 @@\n>  #include <sys/syslimits.h>\n>  #endif\n>  \n> +#include \"../../../../compat/posix.h\"\n> +\n>  static char _clar_path[4096 + 1];\n>  \n>  static int\n\n...seems like an obvious improvement. If we are compiling any C code,\nwe'd want our compatibility macros, etc. Although it does get a little\nfunny, as the contents of clar/ are imported from elsewhere, and now\nwe're modifying that.\n\nIt looks like clar tries to handle portability on its own, so I guess\nanother route is for it to add its own mkdtemp wrapper, and we'd import\nthat fixed version. But it really feels like we're duplicating effort.\n\nThe other half of your patch is the linking side:\n\n> diff -u -ur Makefile Makefile\n> --- Makefile\t2025-08-18 02:35:38 +0200\n> +++ Makefile\t2025-09-05 14:34:43 +0200\n> @@ -3933,7 +3933,7 @@\n>  $(UNIT_TEST_DIR)/clar/clar.o: $(UNIT_TEST_DIR)/clar.suite\n>  $(CLAR_TEST_OBJS): $(UNIT_TEST_DIR)/clar-decls.h\n>  $(CLAR_TEST_OBJS): EXTRA_CPPFLAGS = -I$(UNIT_TEST_DIR)\n> -$(CLAR_TEST_PROG): $(UNIT_TEST_DIR)/clar.suite $(CLAR_TEST_OBJS) $(GITLIBS) GIT-LDFLAGS\n> +$(CLAR_TEST_PROG): $(UNIT_TEST_DIR)/clar.suite $(CLAR_TEST_OBJS) $(COMPAT_OBJS) $(GITLIBS) GIT-LDFLAGS\n>  \t$(call mkdir_p_parent_template)\n>  \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)\n>  \n\nbut I'm not sure that should be necessary. The compat objects are\nincluded in libgit.a, and we should be linking against that when we\nbuild the unit-test executable. At any rate, building with NO_MKDTEMP=1\nfor me on Linux does successfully find gitmkdtemp().  Are you sure this\nhalf of the patch was needed?\n\n-Peff\n"},{"id":"525680","messageId":"41515d85-7afd-4c4a-b0b3-4cd902ca5677@innomotics.com","threadId":"64096","inReplyTo":"20250905213708.GB612697@coredump.intra.peff.net","subject":"Re: [Bug] Compat objects not added to CLAR_TEST_PROG","fromName":"Osipov, Michael (IN IT IN)","fromEmail":"michael.osipov@innomotics.com","sentAt":"2025-09-05T22:12:54Z","receivedAt":"2025-09-05T22:13:03Z","isPatch":false,"sender":{"key":"michael.osipov@innomotics.com","avatar":null},"body":"Let's have a look:\n\nOn 2025-09-05 23:37, Jeff King wrote:\n> [+cc pks for clar portability]\n> \n> On Fri, Sep 05, 2025 at 03:19:50PM +0200, Osipov, Michael (IN IT IN) wrote:\n> \n>> I am building Git 2.51.0 on HP-UX 11.31, previous releases went smoothly.\n> \n> Neat, today I learned HP-UX is still alive and kicking. :)\n> \n> Half of your patch makes sense to me, but I'm puzzled by the other half.\n> This:\n> \n>> diff -u -ur t/unit-tests/clar/clar/sandbox.h git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h\n>> --- t/unit-tests/clar/clar/sandbox.h\t2025-08-18 02:35:38 +0200\n>> +++ t/unit-tests/clar/clar/sandbox.h\t2025-09-05 14:10:52 +0200\n>> @@ -2,6 +2,8 @@\n>>   #include <sys/syslimits.h>\n>>   #endif\n>>   \n>> +#include \"../../../../compat/posix.h\"\n>> +\n>>   static char _clar_path[4096 + 1];\n>>   \n>>   static int\n> \n> ...seems like an obvious improvement. If we are compiling any C code,\n> we'd want our compatibility macros, etc. Although it does get a little\n> funny, as the contents of clar/ are imported from elsewhere, and now\n> we're modifying that.\n> \n> It looks like clar tries to handle portability on its own, so I guess\n> another route is for it to add its own mkdtemp wrapper, and we'd import\n> that fixed version. But it really feels like we're duplicating effort.\n\nI am open to improvements here to get in the compat prototypes...\n\n> The other half of your patch is the linking side:\n> \n>> diff -u -ur Makefile Makefile\n>> --- Makefile\t2025-08-18 02:35:38 +0200\n>> +++ Makefile\t2025-09-05 14:34:43 +0200\n>> @@ -3933,7 +3933,7 @@\n>>   $(UNIT_TEST_DIR)/clar/clar.o: $(UNIT_TEST_DIR)/clar.suite\n>>   $(CLAR_TEST_OBJS): $(UNIT_TEST_DIR)/clar-decls.h\n>>   $(CLAR_TEST_OBJS): EXTRA_CPPFLAGS = -I$(UNIT_TEST_DIR)\n>> -$(CLAR_TEST_PROG): $(UNIT_TEST_DIR)/clar.suite $(CLAR_TEST_OBJS) $(GITLIBS) GIT-LDFLAGS\n>> +$(CLAR_TEST_PROG): $(UNIT_TEST_DIR)/clar.suite $(CLAR_TEST_OBJS) $(COMPAT_OBJS) $(GITLIBS) GIT-LDFLAGS\n>>   \t$(call mkdir_p_parent_template)\n>>   \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)\n>>   \n> \n> but I'm not sure that should be necessary. The compat objects are\n> included in libgit.a, and we should be linking against that when we\n> build the unit-test executable. At any rate, building with NO_MKDTEMP=1\n> for me on Linux does successfully find gitmkdtemp().  Are you sure this\n> half of the patch was needed?\n\nlibgit.a does indeed contain the symbol:\n> root@deblndw002x:/var/tmp/ports/work/git-2.51.0.patched\n> # nm ./libgit.a  | grep mkdtemp\n> [595]    |            0|       0|FUNC |GLOB |0|   UNDEF|gitmkdtemp\n> [204]    |            0|       0|FUNC |GLOB |0|   UNDEF|gitmkdtemp\n> [278]    |            0|       0|FUNC |GLOB |0|   UNDEF|gitmkdtemp\n> Symbols from ./libgit.a[mkdtemp.o]:\n> [1]      |            0|       0|FILE |LOCAL|0|     ABS|compat/mkdtemp.c\n> [110]    |            0|     272|FUNC |GLOB |0|   .text|gitmkdtemp\n\nLet's try to revert the second half and see:\n...and you are right. Since the include does properly replace the \nmissing symbol at compiliation time, linking now works expecte:\n> root@deblndw002x:/var/tmp/ports/work/git-2.51.0.patched\n> # nm t/unit-tests/bin/unit-tests | grep mkdtemp\n> [7332]   |            0|       0|FILE |LOCAL|0|     ABS|compat/mkdtemp.c\n> [16404]  |     73286896|     272|FUNC |GLOB |0|   .text|gitmkdtemp\n\nWe can drop one hunk from the patch, great!\n\nMichael\n"},{"id":"525918","messageId":"aL_bAxZubXMOGWsu@pks.im","threadId":"64096","inReplyTo":"20250905213708.GB612697@coredump.intra.peff.net","subject":"Re: [Bug] Compat objects not added to CLAR_TEST_PROG","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-09-09T07:45:07Z","receivedAt":"2025-09-09T07:45:14Z","isPatch":false,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Fri, Sep 05, 2025 at 05:37:08PM -0400, Jeff King wrote:\n> On Fri, Sep 05, 2025 at 03:19:50PM +0200, Osipov, Michael (IN IT IN) wrote:\n> > diff -u -ur t/unit-tests/clar/clar/sandbox.h git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h\n> > --- t/unit-tests/clar/clar/sandbox.h\t2025-08-18 02:35:38 +0200\n> > +++ t/unit-tests/clar/clar/sandbox.h\t2025-09-05 14:10:52 +0200\n> > @@ -2,6 +2,8 @@\n> >  #include <sys/syslimits.h>\n> >  #endif\n> >  \n> > +#include \"../../../../compat/posix.h\"\n> > +\n> >  static char _clar_path[4096 + 1];\n> >  \n> >  static int\n> \n> ...seems like an obvious improvement. If we are compiling any C code,\n> we'd want our compatibility macros, etc. Although it does get a little\n> funny, as the contents of clar/ are imported from elsewhere, and now\n> we're modifying that.\n> \n> It looks like clar tries to handle portability on its own, so I guess\n> another route is for it to add its own mkdtemp wrapper, and we'd import\n> that fixed version. But it really feels like we're duplicating effort.\n\nWe're duplicating effort indeed, but that effort benefits other\nprojects that use clar.\n\nIn any case, we already have logic to detect whether or not the platform\nshould have `mkdtemp()`:\n\n    #if defined(__MINGW32__)\n        if (_mktemp(_clar_tempdir) == NULL)\n            return -1;\n\n        if (mkdir(_clar_tempdir, 0700) != 0)\n            return -1;\n    #elif defined(_WIN32)\n        if (_mktemp_s(_clar_tempdir, sizeof(_clar_tempdir)) != 0)\n            return -1;\n\n        if (mkdir(_clar_tempdir, 0700) != 0)\n            return -1;\n    #elif defined(__sun) || defined(__TANDEM)\n        if (mktemp(_clar_tempdir) == NULL)\n            return -1;\n\n        if (mkdir(_clar_tempdir, 0700) != 0)\n            return -1;\n    #else\n        if (mkdtemp(_clar_tempdir) == NULL)\n            return -1;\n    #endif\n\nSo that raises the question whether HP-UX has mktemp(3p) -- if so, we\ncan probably fix the issue like this:\n\ndiff --git a/clar/sandbox.h b/clar/sandbox.h\nindex ff43159..5af36f3 100644\n--- a/clar/sandbox.h\n+++ b/clar/sandbox.h\n@@ -164,7 +164,7 @@ static int build_tempdir_path(void)\n \n \tif (mkdir(_clar_tempdir, 0700) != 0)\n \t\treturn -1;\n-#elif defined(__sun) || defined(__TANDEM)\n+#elif defined(__sun) || defined(__TANDEM) || defined(__HPUX)\n \tif (mktemp(_clar_tempdir) == NULL)\n \t\treturn -1;\n \nThe `__HPUX` define is pulled out of thin air, I have no idea what\npreprocessor macro that system sets. But something in that spirit may\nfix that issue. If so, I'm happy to fix this upstream and then pull\nthe latest version into Git.\n\nPatrick\n"},{"id":"525922","messageId":"50da35ac-71f8-49dd-bcd8-83726f1954a9@innomotics.com","threadId":"64096","inReplyTo":"aL_bAxZubXMOGWsu@pks.im","subject":"Re: [Bug] Compat objects not added to CLAR_TEST_PROG","fromName":"Osipov, Michael (IN IT IN)","fromEmail":"michael.osipov@innomotics.com","sentAt":"2025-09-09T08:00:54Z","receivedAt":"2025-09-09T08:00:57Z","isPatch":false,"sender":{"key":"michael.osipov@innomotics.com","avatar":null},"body":"\n\nOn 2025-09-09 09:45, Patrick Steinhardt wrote:\n> On Fri, Sep 05, 2025 at 05:37:08PM -0400, Jeff King wrote:\n>> On Fri, Sep 05, 2025 at 03:19:50PM +0200, Osipov, Michael (IN IT IN) wrote:\n>>> diff -u -ur t/unit-tests/clar/clar/sandbox.h git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h\n>>> --- t/unit-tests/clar/clar/sandbox.h\t2025-08-18 02:35:38 +0200\n>>> +++ t/unit-tests/clar/clar/sandbox.h\t2025-09-05 14:10:52 +0200\n>>> @@ -2,6 +2,8 @@\n>>>   #include <sys/syslimits.h>\n>>>   #endif\n>>>   \n>>> +#include \"../../../../compat/posix.h\"\n>>> +\n>>>   static char _clar_path[4096 + 1];\n>>>   \n>>>   static int\n>>\n>> ...seems like an obvious improvement. If we are compiling any C code,\n>> we'd want our compatibility macros, etc. Although it does get a little\n>> funny, as the contents of clar/ are imported from elsewhere, and now\n>> we're modifying that.\n>>\n>> It looks like clar tries to handle portability on its own, so I guess\n>> another route is for it to add its own mkdtemp wrapper, and we'd import\n>> that fixed version. But it really feels like we're duplicating effort.\n> \n> We're duplicating effort indeed, but that effort benefits other\n> projects that use clar.\n> \n> In any case, we already have logic to detect whether or not the platform\n> should have `mkdtemp()`:\n> \n>      #if defined(__MINGW32__)\n>          if (_mktemp(_clar_tempdir) == NULL)\n>              return -1;\n> \n>          if (mkdir(_clar_tempdir, 0700) != 0)\n>              return -1;\n>      #elif defined(_WIN32)\n>          if (_mktemp_s(_clar_tempdir, sizeof(_clar_tempdir)) != 0)\n>              return -1;\n> \n>          if (mkdir(_clar_tempdir, 0700) != 0)\n>              return -1;\n>      #elif defined(__sun) || defined(__TANDEM)\n>          if (mktemp(_clar_tempdir) == NULL)\n>              return -1;\n> \n>          if (mkdir(_clar_tempdir, 0700) != 0)\n>              return -1;\n>      #else\n>          if (mkdtemp(_clar_tempdir) == NULL)\n>              return -1;\n>      #endif\n> \n> So that raises the question whether HP-UX has mktemp(3p) -- if so, we\n> can probably fix the issue like this:\n> \n> diff --git a/clar/sandbox.h b/clar/sandbox.h\n> index ff43159..5af36f3 100644\n> --- a/clar/sandbox.h\n> +++ b/clar/sandbox.h\n> @@ -164,7 +164,7 @@ static int build_tempdir_path(void)\n>   \n>   \tif (mkdir(_clar_tempdir, 0700) != 0)\n>   \t\treturn -1;\n> -#elif defined(__sun) || defined(__TANDEM)\n> +#elif defined(__sun) || defined(__TANDEM) || defined(__HPUX)\n>   \tif (mktemp(_clar_tempdir) == NULL)\n>   \t\treturn -1;\n>   \n> The `__HPUX` define is pulled out of thin air, I have no idea what\n> preprocessor macro that system sets. But something in that spirit may\n> fix that issue. If so, I'm happy to fix this upstream and then pull\n> the latest version into Git.\n\nI can confirm that your idea works and much better than my idea:\nroot@deblndw002x:/var/tmp/ports/work\n# diff -ur git-2.51.0 git-2.51.0.patched/ | grep -v \"Only in\"\ndiff -u -ur git-2.51.0/t/unit-tests/clar/clar/sandbox.h \ngit-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h\n--- git-2.51.0/t/unit-tests/clar/clar/sandbox.h 2025-08-18 02:35:38 +0200\n+++ git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h 2025-09-09 \n09:50:07 +0200\n@@ -128,7 +128,7 @@\n\n         if (mkdir(_clar_path, 0700) != 0)\n                 return -1;\n-#elif defined(__sun) || defined(__TANDEM)\n+#elif defined(__sun) || defined(__TANDEM) || defined(__hpux)\n         if (mktemp(_clar_path) == NULL)\n                 return -1;\n\nCan you make that happen upstream?\n\nThanks,\n\nMichael\n\n"},{"id":"525941","messageId":"aL_-My5lxRQiOPmh@pks.im","threadId":"64096","inReplyTo":"50da35ac-71f8-49dd-bcd8-83726f1954a9@innomotics.com","subject":"Re: [Bug] Compat objects not added to CLAR_TEST_PROG","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-09-09T10:15:15Z","receivedAt":"2025-09-09T10:15:25Z","isPatch":false,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Tue, Sep 09, 2025 at 10:00:54AM +0200, Osipov, Michael (IN IT IN) wrote:\n> On 2025-09-09 09:45, Patrick Steinhardt wrote:\n> > diff --git a/clar/sandbox.h b/clar/sandbox.h\n> > index ff43159..5af36f3 100644\n> > --- a/clar/sandbox.h\n> > +++ b/clar/sandbox.h\n> > @@ -164,7 +164,7 @@ static int build_tempdir_path(void)\n> >   \tif (mkdir(_clar_tempdir, 0700) != 0)\n> >   \t\treturn -1;\n> > -#elif defined(__sun) || defined(__TANDEM)\n> > +#elif defined(__sun) || defined(__TANDEM) || defined(__HPUX)\n> >   \tif (mktemp(_clar_tempdir) == NULL)\n> >   \t\treturn -1;\n> > The `__HPUX` define is pulled out of thin air, I have no idea what\n> > preprocessor macro that system sets. But something in that spirit may\n> > fix that issue. If so, I'm happy to fix this upstream and then pull\n> > the latest version into Git.\n> \n> I can confirm that your idea works and much better than my idea:\n> root@deblndw002x:/var/tmp/ports/work\n> # diff -ur git-2.51.0 git-2.51.0.patched/ | grep -v \"Only in\"\n> diff -u -ur git-2.51.0/t/unit-tests/clar/clar/sandbox.h\n> git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h\n> --- git-2.51.0/t/unit-tests/clar/clar/sandbox.h 2025-08-18 02:35:38 +0200\n> +++ git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h 2025-09-09 09:50:07\n> +0200\n> @@ -128,7 +128,7 @@\n> \n>         if (mkdir(_clar_path, 0700) != 0)\n>                 return -1;\n> -#elif defined(__sun) || defined(__TANDEM)\n> +#elif defined(__sun) || defined(__TANDEM) || defined(__hpux)\n>         if (mktemp(_clar_path) == NULL)\n>                 return -1;\n> \n> Can you make that happen upstream?\n\nMerged upstream now via [1]. I'll send a patch to the mailing list later\ntoday to bring us to the latest version.\n\nPatrick\n\n[1]: https://github.com/clar-test/clar/pull/120\n"},{"id":"525962","messageId":"d65be6d8-3aca-40e6-9b7c-bc6102c950a1@innomotics.com","threadId":"64096","inReplyTo":"aL_-My5lxRQiOPmh@pks.im","subject":"Re: [Bug] Compat objects not added to CLAR_TEST_PROG","fromName":"Osipov, Michael (IN IT IN)","fromEmail":"michael.osipov@innomotics.com","sentAt":"2025-09-09T12:07:34Z","receivedAt":"2025-09-09T12:07:39Z","isPatch":false,"sender":{"key":"michael.osipov@innomotics.com","avatar":null},"body":"\n\nOn 2025-09-09 12:15, Patrick Steinhardt wrote:\n> On Tue, Sep 09, 2025 at 10:00:54AM +0200, Osipov, Michael (IN IT IN) wrote:\n>> On 2025-09-09 09:45, Patrick Steinhardt wrote:\n>>> diff --git a/clar/sandbox.h b/clar/sandbox.h\n>>> index ff43159..5af36f3 100644\n>>> --- a/clar/sandbox.h\n>>> +++ b/clar/sandbox.h\n>>> @@ -164,7 +164,7 @@ static int build_tempdir_path(void)\n>>>    \tif (mkdir(_clar_tempdir, 0700) != 0)\n>>>    \t\treturn -1;\n>>> -#elif defined(__sun) || defined(__TANDEM)\n>>> +#elif defined(__sun) || defined(__TANDEM) || defined(__HPUX)\n>>>    \tif (mktemp(_clar_tempdir) == NULL)\n>>>    \t\treturn -1;\n>>> The `__HPUX` define is pulled out of thin air, I have no idea what\n>>> preprocessor macro that system sets. But something in that spirit may\n>>> fix that issue. If so, I'm happy to fix this upstream and then pull\n>>> the latest version into Git.\n>>\n>> I can confirm that your idea works and much better than my idea:\n>> root@deblndw002x:/var/tmp/ports/work\n>> # diff -ur git-2.51.0 git-2.51.0.patched/ | grep -v \"Only in\"\n>> diff -u -ur git-2.51.0/t/unit-tests/clar/clar/sandbox.h\n>> git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h\n>> --- git-2.51.0/t/unit-tests/clar/clar/sandbox.h 2025-08-18 02:35:38 +0200\n>> +++ git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h 2025-09-09 09:50:07\n>> +0200\n>> @@ -128,7 +128,7 @@\n>>\n>>          if (mkdir(_clar_path, 0700) != 0)\n>>                  return -1;\n>> -#elif defined(__sun) || defined(__TANDEM)\n>> +#elif defined(__sun) || defined(__TANDEM) || defined(__hpux)\n>>          if (mktemp(_clar_path) == NULL)\n>>                  return -1;\n>>\n>> Can you make that happen upstream?\n> \n> Merged upstream now via [1]. I'll send a patch to the mailing list later\n> today to bring us to the latest version.\n\nThank you, appreciated! Didn't even know what clar was external.\n\n\nMichael\n"}]}