Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
GH-85724: Ignore the MAC from the Touch Bar interface on macOS in uuid#99717
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
…in uuidAll Intel MacBook Pro devices with a Touch Bar have a networkinterface connected to a controller for that device that hasthe same MAC address for all MacBooks.Ignore these MAC adresses in the UUID library.
One thing I haven't seriously looked into yet is how to include tests for my changes, other than a trivial change to test_uuid that will ensure tests fail on an affected device without the changes to uuid.py. I have manually checked that uuid.uuid1() does not use the MAC address for the Touch Bar interface on an affected device. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
1. Remove the "BLACKLIST" variable as it is both lazy naming not necessary2. Be more explicit in tests3. Add test that checks that the mac touchbar mac is actually ignored.
@@ -581,6 +589,18 @@ def _netbios_getnode(): | |||
_generate_time_safe = getattr(_uuid, "generate_time_safe", None) | |||
_UuidCreate = getattr(_uuid, "UuidCreate", None) | |||
_has_uuid_generate_time_safe = _uuid.has_uuid_generate_time_safe | |||
if sys.platform == "darwin" and _generate_time_safe is not None: |
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.
I'm not 100% sure about this test, and in particular not about the test for "darwin".
There are people running Linux on Apple hardware and I don't know if those could be affected by this issue, in particular if there is a driver that exposes a ethernet-like interface to the Touch Bar hardware.
_x = _generate_time_safe()[0] | ||
if _x.endswith(bytes.fromhex(_MACOS_TOUCHBAR_MAC.replace(":", ""))): | ||
_has_uuid_generate_time_safe = False | ||
_generate_time_safe = None |
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.
Would it make sense/be possible to implement this test directly in the _uuid module: remove the function if it returns this address?
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.
Hmmm... Possible yes, sensible maybe not.
The implementation of_uuid.generate_time_safe
has 3 or 4 variants (depending on how you count) and because of that an implementation in C mirrors the Python code above but is more verbose and likely not faster than the Python implementation.
I have a patch, but haven't tested it on a device with a Touch Bar yet. That patch adds 49 lines of code to _uuidmodule.c and removes the 4 lines of python code above.
Uh oh!
There was an error while loading.Please reload this page.
All Intel MacBook Pro devices with a Touch Bar have a network interface connected to a controller for that device that has the same MAC address for all MacBooks.
Ignore these MAC adresses in the UUID library.