Call for testing: OpenSSH 10.1p1
Darren Tucker
dtucker at dtucker.net
Thu Oct 2 08:51:57 AEST 2025
On Wed, Oct 01, 2025 at 12:48:51AM +0100, Sevan Janiyan wrote:
> On 30/09/2025 14:45, Damien Miller wrote:
> > Live testing on suitable non-production systems is also appreciated.
>
> Built fine & ran tests without issue out of the box on macOS 10.15 Catalina,
> linking against OpenSSL 3.4.x.
>
> clock_gettime and its various clock_id definitions didn't show up in darwin
> until macOS 10.12 Sierra (darwin 16).
> The autoconf infra already checks for clock_gettime() so I added a guard in
> misc-agent.c which allowed OpenSSH to build on
> There are two calls to clock_gettime() in
> regress/unittests/test_helper/test_helper.c which I just commented out to
> move forward.
Does the patch below fix all instances?
> The comment in the header of regress/keygen-comment.sh seems corrupt and it
> trips up ancient bash (2.05b) on ancient OS X (10.4) resulting in the error
> "regress/keygen-comment.sh: cannot execute binary file" when running the
> test suite. I cleared that up.
The fix for that one has been committed.
Thanks.
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index 983cd3fe6..2c196ec23 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -494,6 +494,30 @@ localtime_r(const time_t *timep, struct tm *result)
}
#endif
+#ifndef HAVE_CLOCK_GETTIME
+int
+clock_gettime(clockid_t clockid, struct timespec *ts)
+{
+ struct timeval tv;
+
+ if (clockid != CLOCK_REALTIME) {
+ errno = ENOSYS;
+ return -1;
+ }
+ if (ts == NULL) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ if (gettimeofday(&tv, NULL) == -1)
+ return -1;
+
+ ts->tv_sec = tv.tv_sec;
+ ts->tv_nsec = (long)tv.tv_usec * 1000;
+ return 0;
+}
+#endif
+
#ifdef ASAN_OPTIONS
const char *__asan_default_options(void) {
return ASAN_OPTIONS;
diff --git a/openbsd-compat/bsd-misc.h b/openbsd-compat/bsd-misc.h
index 2ad89cd83..8495f471c 100644
--- a/openbsd-compat/bsd-misc.h
+++ b/openbsd-compat/bsd-misc.h
@@ -202,6 +202,14 @@ int flock(int, int);
struct tm *localtime_r(const time_t *, struct tm *);
#endif
+#ifndef HAVE_CLOCK_GETTIME
+typedef int clockid_t;
+#ifndef CLOCK_REALTIME
+# define CLOCK_REALTIME 0
+#endif
+int clock_gettime(clockid_t, struct timespec *);
+#endif
+
#ifndef HAVE_REALPATH
#define realpath(x, y) (sftp_realpath((x), (y)))
#endif
--
Darren Tucker (dtucker at dtucker.net)
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
More information about the openssh-unix-dev
mailing list