-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-32493: Fix uuid.uuid1() on FreeBSD. #7099
Conversation
For what it's worth, this approach looks to me to be cleaner and simpler than that in #7098. I'm not the right person to give a thorough technical review. But perhaps we can merge this just to master initially and see what happens with buildbots there before backporting to 3.7. Unlike some of the other blocker issues for 3.7, this one is a real user-visibile bug, no? |
@vstinner, any opinion? |
uint32_t status; | ||
uuid_create(&uuid, &status); | ||
# if defined(HAVE_UUID_ENC_BE) | ||
unsigned char buf[sizeof(uuid)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The size should be 16 bytes.
https://www.freebsd.org/cgi/man.cgi?query=uuid_create
"must be large enough to hold the 16-octet binary UUID"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since @ned-deily wants this fix, I took the liberty of fixing this issue myself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait. My change only modified the size of the buffer, but not configure, not the call to Py_BuildValue two lines below. I reverted my change.
Anyway, the module constructor has an assertion for sizeof(uuid_t) == 16.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
fbfe6bf
to
fd869ce
Compare
And now GitHub only shows ... nothing, all these commits and the removal of commits are hidden on this page :-( |
@serhiy-storchaka: Sorry, it seems like we worked together on the same branch, your branch :-/ I will no longer touch this branch. I consider that the current code using sizeof(uuid_t) is fine. If you want to use 16, it's up to you. IMHO sizeof(uuid_t) should always be 16, if it's not, we will get a safe Python exception. I prefer to merge the current PR to quickly fix Python 3.7 for the 3.7rc1 release. |
Thanks @serhiy-storchaka for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7. |
GH-7104 is a backport of this pull request to the 3.7 branch. |
Use uuid_enc_be() if available to encode UUID to bytes as big endian. (cherry picked from commit 17d8830) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
An alternate solution using
uuid_enc_be()
.https://bugs.python.org/issue32493