From: Patrick Steinhardt <ps@pks•im>
To: "Alejandro R. Sedeño" <asedeno@mit•edu>
Cc: Git List <git@vger•kernel.org>,
Johannes Schindelin <Johannes.Schindelin@gmx•de>
Subject: Re: git no longer builds on SunOS 5.10, a report
Date: Sun, 13 Oct 2024 21:57:10 +0200 [thread overview]
Message-ID: <ZwwmFtF1Y30y8eoU@pks.im> (raw)
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:
> 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!
> > > 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;
next prev parent reply other threads:[~2024-10-13 19:57 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-12 2:10 git no longer builds on SunOS 5.10, a report Alejandro R. Sedeño
2024-10-12 8:19 ` Patrick Steinhardt
2024-10-12 14:34 ` Alejandro R. Sedeño
2024-10-12 14:40 ` [PATCH] Makefile: adjust sed command for generating "clar-decls.h" Alejandro R. Sedeño
2024-10-12 14:42 ` git no longer builds on SunOS 5.10, a report Alejandro R. Sedeño
2024-10-13 19:57 ` Patrick Steinhardt [this message]
2024-10-13 22:50 ` Alejandro R. Sedeño
2024-10-14 6:20 ` Patrick Steinhardt
2024-10-14 11:45 ` [PATCH 0/2] t/unit-tests: improve clar platform compatibility Patrick Steinhardt
2024-10-14 11:45 ` [PATCH 1/2] t/unit-tests: update clar to 0810a36 Patrick Steinhardt
2024-10-14 11:45 ` [PATCH 2/2] Makefile: adjust sed command for generating "clar-decls.h" Patrick Steinhardt
2024-10-18 15:45 ` Toon Claes
2024-10-18 21:14 ` Taylor Blau
2024-10-21 7:00 ` Patrick Steinhardt
2024-10-21 10:56 ` [PATCH v2 0/5] t/unit-tests: improve clar platform compatibility Patrick Steinhardt
2024-10-21 10:56 ` [PATCH v2 1/5] t/unit-tests: update clar to 206accb Patrick Steinhardt
2024-10-21 10:56 ` [PATCH v2 2/5] Makefile: adjust sed command for generating "clar-decls.h" Patrick Steinhardt
2024-10-21 11:07 ` Kristoffer Haugsbakk
2024-10-21 11:35 ` Patrick Steinhardt
2024-10-21 10:56 ` [PATCH v2 3/5] Makefile: extract script to generate clar declarations Patrick Steinhardt
2024-10-21 10:56 ` [PATCH v2 4/5] cmake: fix compilation of clar-based unit tests Patrick Steinhardt
2024-10-21 10:56 ` [PATCH v2 5/5] cmake: set up proper dependencies for generated clar headers Patrick Steinhardt
2024-11-05 19:55 ` Johannes Schindelin
2024-11-06 10:59 ` Phillip Wood
2024-11-08 12:59 ` Patrick Steinhardt
2024-10-21 20:52 ` [PATCH v2 0/5] t/unit-tests: improve clar platform compatibility Taylor Blau
2024-10-25 12:17 ` karthik nayak
2024-10-26 5:01 ` Bagas Sanjaya
2024-10-27 13:01 ` Patrick Steinhardt
2024-10-27 23:56 ` Taylor Blau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZwwmFtF1Y30y8eoU@pks.im \
--to=ps@pks$(echo .)im \
--cc=Johannes.Schindelin@gmx$(echo .)de \
--cc=asedeno@mit$(echo .)edu \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox