threads / bug / 64096

[Bug] Compat objects not added to CLAR_TEST_PROG

Subject: [Bug] Compat objects not added to CLAR_TEST_PROG

## tl;dr

7 messages between Sep 5, 2025 and Sep 9, 2025.

replies: 6people: 3as markdown or json

Osipov, Michael (IN IT IN)· Sep 5, 2025, 13:19 UTC · lore
Hi folks,

I am building Git 2.51.0 on HP-UX 11.31, previous releases went smoothly. This release now fails with:

Show 17 quoted lines
> /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:

Show 23 quoted lines
> "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

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
Jeff King· Sep 5, 2025, 21:37 UTC · re: Osipov, Michael (IN IT IN) · lore

Re: [Bug] Compat objects not added to CLAR_TEST_PROG

[+cc pks for clar portability]
On Fri, Sep 05, 2025 at 03:19:50PM +0200, Osipov, Michael (IN IT IN) wrote:
> I am building Git 2.51.0 on HP-UX 11.31, previous releases went smoothly.
Neat, today I learned HP-UX is still alive and kicking. :)

Half of your patch makes sense to me, but I'm puzzled by the other half. This:

Show 12 quoted lines
> 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

...seems like an obvious improvement. If we are compiling any C code, we'd want our compatibility macros, etc. Although it does get a little funny, as the contents of clar/ are imported from elsewhere, and now we're modifying that.

It looks like clar tries to handle portability on its own, so I guess another route is for it to add its own mkdtemp wrapper, and we'd import that fixed version. But it really feels like we're duplicating effort.

The other half of your patch is the linking side:
Show 12 quoted lines
> 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)
>  

but I'm not sure that should be necessary. The compat objects are included in libgit.a, and we should be linking against that when we build the unit-test executable. At any rate, building with NO_MKDTEMP=1 for me on Linux does successfully find gitmkdtemp(). Are you sure this half of the patch was needed?

-Peff
Osipov, Michael (IN IT IN)· Sep 5, 2025, 22:12 UTC · re: Jeff King · lore

Re: [Bug] Compat objects not added to CLAR_TEST_PROG

Let's have a look:
On 2025-09-05 23:37, Jeff King wrote:
Show 32 quoted lines
> [+cc pks for clar portability]
> 
> On Fri, Sep 05, 2025 at 03:19:50PM +0200, Osipov, Michael (IN IT IN) wrote:
> 
>> I am building Git 2.51.0 on HP-UX 11.31, previous releases went smoothly.
> 
> Neat, today I learned HP-UX is still alive and kicking. :)
> 
> Half of your patch makes sense to me, but I'm puzzled by the other half.
> This:
> 
>> 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
> 
> ...seems like an obvious improvement. If we are compiling any C code,
> we'd want our compatibility macros, etc. Although it does get a little
> funny, as the contents of clar/ are imported from elsewhere, and now
> we're modifying that.
> 
> It looks like clar tries to handle portability on its own, so I guess
> another route is for it to add its own mkdtemp wrapper, and we'd import
> that fixed version. But it really feels like we're duplicating effort.
I am open to improvements here to get in the compat prototypes...
Show 20 quoted lines
> The other half of your patch is the linking side:
> 
>> 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)
>>   
> 
> but I'm not sure that should be necessary. The compat objects are
> included in libgit.a, and we should be linking against that when we
> build the unit-test executable. At any rate, building with NO_MKDTEMP=1
> for me on Linux does successfully find gitmkdtemp().  Are you sure this
> half of the patch was needed?
libgit.a does indeed contain the symbol:
Show 8 quoted lines
> root@deblndw002x:/var/tmp/ports/work/git-2.51.0.patched
> # nm ./libgit.a  | grep mkdtemp
> [595]    |            0|       0|FUNC |GLOB |0|   UNDEF|gitmkdtemp
> [204]    |            0|       0|FUNC |GLOB |0|   UNDEF|gitmkdtemp
> [278]    |            0|       0|FUNC |GLOB |0|   UNDEF|gitmkdtemp
> Symbols from ./libgit.a[mkdtemp.o]:
> [1]      |            0|       0|FILE |LOCAL|0|     ABS|compat/mkdtemp.c
> [110]    |            0|     272|FUNC |GLOB |0|   .text|gitmkdtemp

Let's try to revert the second half and see: ...and you are right. Since the include does properly replace the missing symbol at compiliation time, linking now works expecte:

> root@deblndw002x:/var/tmp/ports/work/git-2.51.0.patched
> # nm t/unit-tests/bin/unit-tests | grep mkdtemp
> [7332]   |            0|       0|FILE |LOCAL|0|     ABS|compat/mkdtemp.c
> [16404]  |     73286896|     272|FUNC |GLOB |0|   .text|gitmkdtemp
We can drop one hunk from the patch, great!
Michael
Patrick Steinhardt· Sep 9, 2025, 07:45 UTC · re: Jeff King · lore

Re: [Bug] Compat objects not added to CLAR_TEST_PROG

On Fri, Sep 05, 2025 at 05:37:08PM -0400, Jeff King wrote:
Show 22 quoted lines
> On Fri, Sep 05, 2025 at 03:19:50PM +0200, Osipov, Michael (IN IT IN) wrote:
> > 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
> 
> ...seems like an obvious improvement. If we are compiling any C code,
> we'd want our compatibility macros, etc. Although it does get a little
> funny, as the contents of clar/ are imported from elsewhere, and now
> we're modifying that.
> 
> It looks like clar tries to handle portability on its own, so I guess
> another route is for it to add its own mkdtemp wrapper, and we'd import
> that fixed version. But it really feels like we're duplicating effort.

We're duplicating effort indeed, but that effort benefits other projects that use clar.

In any case, we already have logic to detect whether or not the platform should have `mkdtemp()`:

    #if defined(__MINGW32__)
        if (_mktemp(_clar_tempdir) == NULL)
            return -1;
        if (mkdir(_clar_tempdir, 0700) != 0)
            return -1;
    #elif defined(_WIN32)
        if (_mktemp_s(_clar_tempdir, sizeof(_clar_tempdir)) != 0)
            return -1;
        if (mkdir(_clar_tempdir, 0700) != 0)
            return -1;
    #elif defined(__sun) || defined(__TANDEM)
        if (mktemp(_clar_tempdir) == NULL)
            return -1;
        if (mkdir(_clar_tempdir, 0700) != 0)
            return -1;
    #else
        if (mkdtemp(_clar_tempdir) == NULL)
            return -1;
    #endif

So that raises the question whether HP-UX has mktemp(3p) -- if so, we can probably fix the issue like this:

diff --git a/clar/sandbox.h b/clar/sandbox.h
index ff43159..5af36f3 100644
--- a/clar/sandbox.h
+++ b/clar/sandbox.h
@@ -164,7 +164,7 @@ static int build_tempdir_path(void)
 
 	if (mkdir(_clar_tempdir, 0700) != 0)
 		return -1;
-#elif defined(__sun) || defined(__TANDEM)
+#elif defined(__sun) || defined(__TANDEM) || defined(__HPUX)
 	if (mktemp(_clar_tempdir) == NULL)
 		return -1;
 
The `__HPUX` define is pulled out of thin air, I have no idea what
preprocessor macro that system sets. But something in that spirit may
fix that issue. If so, I'm happy to fix this upstream and then pull
the latest version into Git.

Patrick
Osipov, Michael (IN IT IN)· Sep 9, 2025, 08:00 UTC · re: Patrick Steinhardt · lore

Re: [Bug] Compat objects not added to CLAR_TEST_PROG

On 2025-09-09 09:45, Patrick Steinhardt wrote:
Show 73 quoted lines
> On Fri, Sep 05, 2025 at 05:37:08PM -0400, Jeff King wrote:
>> On Fri, Sep 05, 2025 at 03:19:50PM +0200, Osipov, Michael (IN IT IN) wrote:
>>> 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
>>
>> ...seems like an obvious improvement. If we are compiling any C code,
>> we'd want our compatibility macros, etc. Although it does get a little
>> funny, as the contents of clar/ are imported from elsewhere, and now
>> we're modifying that.
>>
>> It looks like clar tries to handle portability on its own, so I guess
>> another route is for it to add its own mkdtemp wrapper, and we'd import
>> that fixed version. But it really feels like we're duplicating effort.
> 
> We're duplicating effort indeed, but that effort benefits other
> projects that use clar.
> 
> In any case, we already have logic to detect whether or not the platform
> should have `mkdtemp()`:
> 
>      #if defined(__MINGW32__)
>          if (_mktemp(_clar_tempdir) == NULL)
>              return -1;
> 
>          if (mkdir(_clar_tempdir, 0700) != 0)
>              return -1;
>      #elif defined(_WIN32)
>          if (_mktemp_s(_clar_tempdir, sizeof(_clar_tempdir)) != 0)
>              return -1;
> 
>          if (mkdir(_clar_tempdir, 0700) != 0)
>              return -1;
>      #elif defined(__sun) || defined(__TANDEM)
>          if (mktemp(_clar_tempdir) == NULL)
>              return -1;
> 
>          if (mkdir(_clar_tempdir, 0700) != 0)
>              return -1;
>      #else
>          if (mkdtemp(_clar_tempdir) == NULL)
>              return -1;
>      #endif
> 
> So that raises the question whether HP-UX has mktemp(3p) -- if so, we
> can probably fix the issue like this:
> 
> diff --git a/clar/sandbox.h b/clar/sandbox.h
> index ff43159..5af36f3 100644
> --- a/clar/sandbox.h
> +++ b/clar/sandbox.h
> @@ -164,7 +164,7 @@ static int build_tempdir_path(void)
>   
>   	if (mkdir(_clar_tempdir, 0700) != 0)
>   		return -1;
> -#elif defined(__sun) || defined(__TANDEM)
> +#elif defined(__sun) || defined(__TANDEM) || defined(__HPUX)
>   	if (mktemp(_clar_tempdir) == NULL)
>   		return -1;
>   
> The `__HPUX` define is pulled out of thin air, I have no idea what
> preprocessor macro that system sets. But something in that spirit may
> fix that issue. If so, I'm happy to fix this upstream and then pull
> the latest version into Git.

I can confirm that your idea works and much better than my idea: root@deblndw002x:/var/tmp/ports/work # diff -ur git-2.51.0 git-2.51.0.patched/ | grep -v "Only in" diff -u -ur git-2.51.0/t/unit-tests/clar/clar/sandbox.h git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h --- git-2.51.0/t/unit-tests/clar/clar/sandbox.h 2025-08-18 02:35:38 +0200 +++ git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h 2025-09-09 09:50:07 +0200

@@ -128,7 +128,7 @@

         if (mkdir(_clar_path, 0700) != 0)
                 return -1;
-#elif defined(__sun) || defined(__TANDEM)
+#elif defined(__sun) || defined(__TANDEM) || defined(__hpux)
         if (mktemp(_clar_path) == NULL)
                 return -1;

Can you make that happen upstream?

Thanks,

Michael
Patrick Steinhardt· Sep 9, 2025, 10:15 UTC · re: Osipov, Michael (IN IT IN) · lore

Re: [Bug] Compat objects not added to CLAR_TEST_PROG

On Tue, Sep 09, 2025 at 10:00:54AM +0200, Osipov, Michael (IN IT IN) wrote:
Show 35 quoted lines
> On 2025-09-09 09:45, Patrick Steinhardt wrote:
> > diff --git a/clar/sandbox.h b/clar/sandbox.h
> > index ff43159..5af36f3 100644
> > --- a/clar/sandbox.h
> > +++ b/clar/sandbox.h
> > @@ -164,7 +164,7 @@ static int build_tempdir_path(void)
> >   	if (mkdir(_clar_tempdir, 0700) != 0)
> >   		return -1;
> > -#elif defined(__sun) || defined(__TANDEM)
> > +#elif defined(__sun) || defined(__TANDEM) || defined(__HPUX)
> >   	if (mktemp(_clar_tempdir) == NULL)
> >   		return -1;
> > The `__HPUX` define is pulled out of thin air, I have no idea what
> > preprocessor macro that system sets. But something in that spirit may
> > fix that issue. If so, I'm happy to fix this upstream and then pull
> > the latest version into Git.
> 
> I can confirm that your idea works and much better than my idea:
> root@deblndw002x:/var/tmp/ports/work
> # diff -ur git-2.51.0 git-2.51.0.patched/ | grep -v "Only in"
> diff -u -ur git-2.51.0/t/unit-tests/clar/clar/sandbox.h
> git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h
> --- git-2.51.0/t/unit-tests/clar/clar/sandbox.h 2025-08-18 02:35:38 +0200
> +++ git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h 2025-09-09 09:50:07
> +0200
> @@ -128,7 +128,7 @@
> 
>         if (mkdir(_clar_path, 0700) != 0)
>                 return -1;
> -#elif defined(__sun) || defined(__TANDEM)
> +#elif defined(__sun) || defined(__TANDEM) || defined(__hpux)
>         if (mktemp(_clar_path) == NULL)
>                 return -1;
> 
> Can you make that happen upstream?

Merged upstream now via [1]. I'll send a patch to the mailing list later today to bring us to the latest version.

Patrick
[1]: https://github.com/clar-test/clar/pull/120
Osipov, Michael (IN IT IN)· Sep 9, 2025, 12:07 UTC · re: Patrick Steinhardt · lore

Re: [Bug] Compat objects not added to CLAR_TEST_PROG

On 2025-09-09 12:15, Patrick Steinhardt wrote:
Show 39 quoted lines
> On Tue, Sep 09, 2025 at 10:00:54AM +0200, Osipov, Michael (IN IT IN) wrote:
>> On 2025-09-09 09:45, Patrick Steinhardt wrote:
>>> diff --git a/clar/sandbox.h b/clar/sandbox.h
>>> index ff43159..5af36f3 100644
>>> --- a/clar/sandbox.h
>>> +++ b/clar/sandbox.h
>>> @@ -164,7 +164,7 @@ static int build_tempdir_path(void)
>>>    	if (mkdir(_clar_tempdir, 0700) != 0)
>>>    		return -1;
>>> -#elif defined(__sun) || defined(__TANDEM)
>>> +#elif defined(__sun) || defined(__TANDEM) || defined(__HPUX)
>>>    	if (mktemp(_clar_tempdir) == NULL)
>>>    		return -1;
>>> The `__HPUX` define is pulled out of thin air, I have no idea what
>>> preprocessor macro that system sets. But something in that spirit may
>>> fix that issue. If so, I'm happy to fix this upstream and then pull
>>> the latest version into Git.
>>
>> I can confirm that your idea works and much better than my idea:
>> root@deblndw002x:/var/tmp/ports/work
>> # diff -ur git-2.51.0 git-2.51.0.patched/ | grep -v "Only in"
>> diff -u -ur git-2.51.0/t/unit-tests/clar/clar/sandbox.h
>> git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h
>> --- git-2.51.0/t/unit-tests/clar/clar/sandbox.h 2025-08-18 02:35:38 +0200
>> +++ git-2.51.0.patched/t/unit-tests/clar/clar/sandbox.h 2025-09-09 09:50:07
>> +0200
>> @@ -128,7 +128,7 @@
>>
>>          if (mkdir(_clar_path, 0700) != 0)
>>                  return -1;
>> -#elif defined(__sun) || defined(__TANDEM)
>> +#elif defined(__sun) || defined(__TANDEM) || defined(__hpux)
>>          if (mktemp(_clar_path) == NULL)
>>                  return -1;
>>
>> Can you make that happen upstream?
> 
> Merged upstream now via [1]. I'll send a patch to the mailing list later
> today to bring us to the latest version.
Thank you, appreciated! Didn't even know what clar was external.
Michael

← back to recent threads