git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git no longer builds on SunOS 5.10, a report

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 13, 2024, 19:57 UTC
Message-ID
<ZwwmFtF1Y30y8eoU@pks.im>
In-Reply-To
<CAOO-Oz0+sOpF6YQHSu0ytCO5TL+Anpr1k_9vQx6hebr624WjMA@mail.gmail.com>
On Sat, Oct 12, 2024 at 10:34:18AM -0400, Alejandro R. Sedeño wrote:
Show 24 quoted lines
> On Sat, Oct 12, 2024 at 4:20 AM Patrick Steinhardt <ps@pks.im> wrote:
> > On Fri, Oct 11, 2024 at 10:10:26PM -0400, Alejandro R. Sedeño wrote:
> diff --git a/Makefile b/Makefile
> index 2dde1fd2b8..87c1f9e220 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -3906,7 +3906,7 @@ GIT-TEST-SUITES: FORCE
> 
>  $(UNIT_TEST_DIR)/clar-decls.h: $(patsubst
> %,$(UNIT_TEST_DIR)/%.c,$(CLAR_TEST_SUITES)) GIT-TEST-SUITES
>         $(QUIET_GEN)for suite in $(CLAR_TEST_SUITES); do \
> -               sed -ne "s/^\(void
> test_$${suite}__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)$$\)/extern \1;/p"
> $(UNIT_TEST_DIR)/$$suite.c; \
> +               sed -ne "s/^\(void
> test_$${suite}__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)\)$$/extern \1;/p"
> $(UNIT_TEST_DIR)/$$suite.c; \
>         done >$@
>  $(UNIT_TEST_DIR)/clar.suite: $(UNIT_TEST_DIR)/clar-decls.h
>         $(QUIET_GEN)awk -f $(UNIT_TEST_DIR)/clar-generate.awk $<
> >$(UNIT_TEST_DIR)/clar.suite
> 
> Or feel free to grab the entire commit from here:
> https://asedeno.scripts.mit.edu/gitweb/?p=git.git;a=shortlog;h=refs/heads/clar_sed_tweak
Thanks!
Show 25 quoted lines
> > > The next issue was that clar/sandbox.h uses mkdtemp, which I don't
> > > have here. Git has solved this in compat/mkdtemp.c via
> > > git-compat-util.h, but clar is not using it. Adding git-compat-util.h
> > > to clar/sandbox.h feels weird, but does get us further along. That
> > > change introduced banned.h into clar, which exposed the use of strncpy
> > > and localtime, both otherwise banned in git.
> >
> > Yeah, we don't want to pull in that header. The clar is from upstream,
> > so ideally we shouldn't have to modify it with non-upstreamable bits.
> >
> > In any case, I've got a similar report yesterday where some functions
> > weren't available. The root cause is that we don't set `_POSIX_C_SOURCE`
> > in "clar.c", so with the below patch things started to work. Does that
> > patch work for you, too? At least I think it should, as [1] mentions
> > that the function is available on SunOS when those defines exist.
> >
> > In any case, the patch has already been merged upstream [2], and I'll
> > send a patch early next week that updates our bundled version of clar.
> >
> > [1]: https://www.unix.com/man-page/sunos/3/MKDTEMP/
> > [2]: https://github.com/clar-test/clar/pull/106
> 
> The listed man page is from the Linux Programmer's Manual, regardless of
> the url path. It won't be enough here as mkdtemp is nowhere to be found
> in /usr/include or any other /usr/**/include.

Okay. I assume that both mktemp and mkdir are available though, right? If so, does the below patch work? The last bit is new, where we now use the same mkdtemp implementation as we use on NonStop in clar.

Patrick
diff --git a/t/unit-tests/clar/clar.c b/t/unit-tests/clar/clar.c
index cef0f023c2..064ca5c2ea 100644
--- a/t/unit-tests/clar/clar.c
+++ b/t/unit-tests/clar/clar.c
@@ -4,6 +4,10 @@
  * This file is part of clar, distributed under the ISC license.
  * For full terms see the included COPYING file.
  */
+
+#define _DARWIN_C_SOURCE
+#define _POSIX_C_SOURCE=200809L
+
 #include <assert.h>
 #include <setjmp.h>
 #include <stdlib.h>
@@ -271,9 +275,7 @@ static double clar_time_diff(clar_time *start, clar_time *end)
 
 static void clar_time_now(clar_time *out)
 {
-	struct timezone tz;
-
-	gettimeofday(out, &tz);
+	gettimeofday(out, NULL);
 }
 
 static double clar_time_diff(clar_time *start, clar_time *end)
diff --git a/t/unit-tests/clar/clar/sandbox.h b/t/unit-tests/clar/clar/sandbox.h
index e25057b7c4..b499d2e1e6 100644
--- a/t/unit-tests/clar/clar/sandbox.h
+++ b/t/unit-tests/clar/clar/sandbox.h
@@ -122,7 +122,7 @@ static int build_sandbox_path(void)
 
 	if (mkdir(_clar_path, 0700) != 0)
 		return -1;
-#elif defined(__TANDEM)
+#elif defined(__sunos) || defined(__TANDEM)
 	if (mktemp(_clar_path) == NULL)
 		return -1;
 
Previous: Alejandro R. SedeñoNext: Alejandro R. Sedeño
Message 6 of 30 in “git no longer builds on SunOS 5.10, a report”
  1. Alejandro R. SedeñoOct 12, 2024
  2. Patrick SteinhardtOct 12, 2024
  3. Alejandro R. SedeñoOct 12, 2024
  4. Makefile: adjust sed command for generating "clar-decls.h"Alejandro R. Sedeño, Oct 12, 2024
  5. Alejandro R. SedeñoOct 12, 2024
  6. Patrick SteinhardtOct 13, 2024
  7. Alejandro R. SedeñoOct 13, 2024
  8. Patrick SteinhardtOct 14, 2024
  9. 0/2 t/unit-tests: improve clar platform compatibilityPatrick Steinhardt, Oct 14, 2024
  10. 1/2 t/unit-tests: update clar to 0810a36Patrick Steinhardt, Oct 14, 2024
  11. 2/2 Makefile: adjust sed command for generating "clar-decls.h"Patrick Steinhardt, Oct 14, 2024
  12. Toon ClaesOct 18, 2024
  13. Taylor BlauOct 18, 2024
  14. Patrick SteinhardtOct 21, 2024
  15. 0/5 t/unit-tests: improve clar platform compatibilityPatrick Steinhardt, Oct 21, 2024
  16. 1/5 t/unit-tests: update clar to 206accbPatrick Steinhardt, Oct 21, 2024
  17. 2/5 Makefile: adjust sed command for generating "clar-decls.h"Patrick Steinhardt, Oct 21, 2024
  18. Kristoffer HaugsbakkOct 21, 2024
  19. Patrick SteinhardtOct 21, 2024
  20. 3/5 Makefile: extract script to generate clar declarationsPatrick Steinhardt, Oct 21, 2024
  21. 4/5 cmake: fix compilation of clar-based unit testsPatrick Steinhardt, Oct 21, 2024
  22. 5/5 cmake: set up proper dependencies for generated clar headersPatrick Steinhardt, Oct 21, 2024
  23. Johannes SchindelinNov 5, 2024
  24. Phillip WoodNov 6, 2024
  25. Patrick SteinhardtNov 8, 2024
  26. Taylor BlauOct 21, 2024
  27. karthik nayakOct 25, 2024
  28. Bagas SanjayaOct 26, 2024
  29. Patrick SteinhardtOct 27, 2024
  30. Taylor BlauOct 27, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.