]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-154389: Do not use uuid_create() on OpenBSD (GH-154390)
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 21 Jul 2026 18:05:41 +0000 (21:05 +0300)
committerGitHub <noreply@github.com>
Tue, 21 Jul 2026 18:05:41 +0000 (18:05 +0000)
Like NetBSD, OpenBSD generates version 4 UUIDs in uuid_create(), so it
cannot be used for uuid.uuid1().

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Misc/NEWS.d/next/Library/2026-07-21-20-34-05.gh-issue-154389.DlTiii.rst [new file with mode: 0644]
configure
configure.ac

diff --git a/Misc/NEWS.d/next/Library/2026-07-21-20-34-05.gh-issue-154389.DlTiii.rst b/Misc/NEWS.d/next/Library/2026-07-21-20-34-05.gh-issue-154389.DlTiii.rst
new file mode 100644 (file)
index 0000000..eb2e2ed
--- /dev/null
@@ -0,0 +1,3 @@
+Fix :func:`uuid.uuid1` on OpenBSD:
+it returned a version 4 UUID,
+because ``uuid_create()`` generates random UUIDs on this platform.
index 71fa0b435d16505463b2786fc39a35792bbead8a..93bc5545e9de6edc4433a45f842af141fe3fea57 100755 (executable)
--- a/configure
+++ b/configure
@@ -15294,9 +15294,10 @@ then :
 
 fi
 
-# gh-124228: While the libuuid library is available on NetBSD, it supports only UUID version 4.
+# gh-124228: While the libuuid library is available on NetBSD and OpenBSD,
+# it supports only UUID version 4.
 # This restriction inhibits the proper generation of time-based UUIDs.
-if test "$ac_sys_system" = "NetBSD"; then
+if test "$ac_sys_system" = "NetBSD" || test "$ac_sys_system" = "OpenBSD"; then
   have_uuid=missing
   printf "%s\n" "#define HAVE_UUID_H 0" >>confdefs.h
 
index 5fcf406087cbe5ee9f874835b5e90baac87b0ed5..a9c706f3c23cb1c386904723441069064be60e6f 100644 (file)
@@ -4070,9 +4070,10 @@ AS_VAR_IF([ac_cv_have_uuid_generate_time_safe], [yes], [
   AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE], [1])
 ])
 
-# gh-124228: While the libuuid library is available on NetBSD, it supports only UUID version 4.
+# gh-124228: While the libuuid library is available on NetBSD and OpenBSD,
+# it supports only UUID version 4.
 # This restriction inhibits the proper generation of time-based UUIDs.
-if test "$ac_sys_system" = "NetBSD"; then
+if test "$ac_sys_system" = "NetBSD" || test "$ac_sys_system" = "OpenBSD"; then
   have_uuid=missing
   AC_DEFINE([HAVE_UUID_H], [0])
 fi