python / python/cpython

UUID's _arp_getnode does not account for omitted leading 0's in arp output on Darwin

Open
#101,531 0 comments 0 reactions 1 assignee View on GitHub

@ronaldoussoren is already working on this.

Since Dec 27, 2023.

OS-mac stdlib type-bug
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

Bug report

UUID does not account for omitted leading 0's in arp output on Darwin, causing _arp_getnode to return an incorrect value.

ARP:

arp 172.17.0.3
pikvm.local.lan (172.17.0.3) at e4:5f:1:67:22:2a on en0 ifscope [ethernet]

Bugged Output:

>>> import uuid
>>> import os, socket
>>> socket.gethostbyname = lambda x: '172.17.0.3'
>>> mac = uuid._arp_getnode()
>>> mac
15693565600298
>>> hex(mac)
'0xe45f167222a'

Expected:

>>> mac
251096696562218
>>> hex(mac)
'0xe45f0167222a'

Your environment

  • CPython versions tested on: 3.10.9
  • Operating system and architecture: macOS 13.2 22D49 arm64
Linked PRs
  • gh-105004

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.