Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-75371

QSysInfo::machineUniqueId() is not unique on MacOS

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.12.3
    • Fix Version/s: 5.12.5, 5.14.0 Alpha
    • Component/s: Core: Other
    • Labels:
      None
    • Platform/s:
      macOS
    • Commits:
      0d024bd0a63fa7a741f4f118a3b48806b695594f (qt/qtbase/5.12)

      Description

      the function QSysInfo::machineUniqueId() returns the same value for several computers, and this value changes after each update of the OS

      the source code of the function refers to sysctlbyname("kern.uuid") which seems to returns the uuid of the kernel (kernel version), instead of the uuid of the computer

      I think this code should be better (link to IOKit framework) :

      io_registry_entry_t registryEntry = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/");
      CFStringRef stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(registryEntry, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0);
      CFStringGetCString(stringRef, uuid, uuidlen, kCFStringEncodingMacRoman);
      CFRelease(stringRef);
      IOObjectRelease(registryEntry);

       

      and I would like to thank you for your wonderful work on Qt ! It's an amazing platform...

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            thiago Thiago Macieira
            Reporter:
            filmars Philippe Castell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes