-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-33542: Ignore DUID in uuid.get_node on Windows #6922
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
Conversation
Lib/uuid.py
Outdated
@@ -488,7 +488,7 @@ def _ipconfig_getnode(): | |||
with proc: | |||
for line in proc.stdout: | |||
value = line.split(':')[-1].strip().lower() | |||
if re.match('([0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]', value): | |||
if re.match('^(?:[0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]$', value): |
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.
^
at the begin of the pattern is not needed since re.match()
always matches at the start of the string.
You can use re.fullmatch()
in Python 3.
@@ -0,0 +1 @@ | |||
Prevent `uuid.get_node` from using a DUID instead of a MAC on Windows. |
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.
Please add "Patch by yourname."
Use ``uuid.get_node``
instead of `uuid.get_node`
.
And since it is your first contribution, please add your name in |
Not a problem. Would it be better to use |
I think it is better to use |
d9d8a9e
to
261ac16
Compare
I've made the requested changes (I think). I'm happy to do the work for the backporting, but my understanding is that those PRs would happen after this PR is merged? |
uuid._ipconfig_getnode did not validate the maximum length of the value, so long as the value had the same type of formatting as a MAC address. This let it select DUIDs as MAC addresses. It now requires an exact length match.
Thanks @CtrlZvi for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6, 3.7. |
uuid._ipconfig_getnode did not validate the maximum length of the value, so long as the value had the same type of formatting as a MAC address. This let it select DUIDs as MAC addresses. It now requires an exact length match. (cherry picked from commit c66c342) Co-authored-by: CtrlZvi <viz+github@flippedperspective.com>
GH-7011 is a backport of this pull request to the 3.7 branch. |
Sorry, @CtrlZvi and @serhiy-storchaka, I could not cleanly backport this to |
Sorry, @CtrlZvi and @serhiy-storchaka, I could not cleanly backport this to |
) uuid._ipconfig_getnode did not validate the maximum length of the value, so long as the value had the same type of formatting as a MAC address. This let it select DUIDs as MAC addresses. It now requires an exact length match.. (cherry picked from commit c66c342) Co-authored-by: CtrlZvi <viz+github@flippedperspective.com>
GH-7014 is a backport of this pull request to the 3.6 branch. |
) uuid._ipconfig_getnode did not validate the maximum length of the value, so long as the value had the same type of formatting as a MAC address. This let it select DUIDs as MAC addresses. It now requires an exact length match.. (cherry picked from commit c66c342) Co-authored-by: CtrlZvi <viz+github@flippedperspective.com>
GH-7015 is a backport of this pull request to the 2.7 branch. |
uuid._ipconfig_getnode did not validate the maximum length of the value, so long as the value had the same type of formatting as a MAC address. This let it select DUIDs as MAC addresses. It now requires an exact length match. (cherry picked from commit c66c342) Co-authored-by: CtrlZvi <viz+github@flippedperspective.com>
…H-7015) uuid._ipconfig_getnode did not validate the maximum length of the value, so long as the value had the same type of formatting as a MAC address. This let it select DUIDs as MAC addresses. It now requires an exact length match.. (cherry picked from commit c66c342) Co-authored-by: CtrlZvi <viz+github@flippedperspective.com>
…H-7014) uuid._ipconfig_getnode did not validate the maximum length of the value, so long as the value had the same type of formatting as a MAC address. This let it select DUIDs as MAC addresses. It now requires an exact length match. (cherry picked from commit c66c342) Co-authored-by: CtrlZvi <viz+github@flippedperspective.com>
uuid._ipconfig_getnode did not validate the maximum length of the value,
so long as the value had the same type of formatting as a MAC address.
This let it select DUIDs as MAC addresses. It now requires an exact
length match.
https://bugs.python.org/issue33542