-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
UUID _ifconfig_getnodes() will always return None due to broken logic #98415
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
Labels
type-bug
An unexpected behavior, bug, or error
Comments
vstinner
pushed a commit
that referenced
this issue
Nov 2, 2022
The uuid.getnode() function has multiple implementations, tested sequentially. The ifconfig implementation was incorrect and always failed: fix it. In practice, functions of libuuid library are preferred, if available: uuid_generate_time_safe(), uuid_create() or uuid_generate_time(). Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Nov 2, 2022
…98423) The uuid.getnode() function has multiple implementations, tested sequentially. The ifconfig implementation was incorrect and always failed: fix it. In practice, functions of libuuid library are preferred, if available: uuid_generate_time_safe(), uuid_create() or uuid_generate_time(). (cherry picked from commit e3ec272) Co-authored-by: Chaim Sanders <csanders-git@users.noreply.github.com> Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Nov 2, 2022
…98423) The uuid.getnode() function has multiple implementations, tested sequentially. The ifconfig implementation was incorrect and always failed: fix it. In practice, functions of libuuid library are preferred, if available: uuid_generate_time_safe(), uuid_create() or uuid_generate_time(). (cherry picked from commit e3ec272) Co-authored-by: Chaim Sanders <csanders-git@users.noreply.github.com> Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
miss-islington
added a commit
that referenced
this issue
Nov 2, 2022
The uuid.getnode() function has multiple implementations, tested sequentially. The ifconfig implementation was incorrect and always failed: fix it. In practice, functions of libuuid library are preferred, if available: uuid_generate_time_safe(), uuid_create() or uuid_generate_time(). (cherry picked from commit e3ec272) Co-authored-by: Chaim Sanders <csanders-git@users.noreply.github.com> Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
miss-islington
added a commit
that referenced
this issue
Nov 2, 2022
The uuid.getnode() function has multiple implementations, tested sequentially. The ifconfig implementation was incorrect and always failed: fix it. In practice, functions of libuuid library are preferred, if available: uuid_generate_time_safe(), uuid_create() or uuid_generate_time(). (cherry picked from commit e3ec272) Co-authored-by: Chaim Sanders <csanders-git@users.noreply.github.com> Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Bug report
UUID reads the MAC address from the local system in order to generate UUIDv1/v2 spec requests. On Linux and Darwin and unknown platforms it will attempt to run _ifconfig_getnode() to search through
ifconfig
in order to get the MAC value by searching ifconfig. On MacOS and Unknown platforms it will do this first. (https://github.com/python/cpython/blob/main/Lib/uuid.py#L627)_ifconfig_getnode() is designed to take a number of args, likely to support multiple systems. Currently this supports 3 flags,
''
'-a
' and '-av
' (https://github.com/python/cpython/blob/main/Lib/uuid.py#L510). This function can never move passed calling the first argument as it will always return. Worse yet, on MacOS and linux passing''
as the argument will actually run the equivalent of/sbin/ifconfig ""
which will always return to stderr (which is discarded). This is very likely due to the developer not understanding how popen generates the command string (see https://github.com/python/cpython/blob/main/Lib/subprocess.py#L615)Due to an incorrectly tabbed return statement this will always result in the function bailing out before testing other valid options. In all tested cases this also results in the function ALWAYS return None. Making the check useless.
https://github.com/python/cpython/blob/main/Lib/uuid.py#L506
The smallest example of this problem looks something like this
Your environment
The text was updated successfully, but these errors were encountered: