• Bug#1105772: libsensors5: Parsing Error in sysfs device path for ISA se

    From Aurelien Jarno@21:1/5 to Michael Lettrich on Wed Jul 16 20:40:01 2025
    Hi,

    On 2025-05-14 15:39, Michael Lettrich wrote:
    Package: libsensors5
    Version: 1:3.6.0-7.1 arm64
    Severity: normal
    Tags: patch upstream
    X-Debbugs-Cc: [email protected], [email protected]

    Dear Maintainer,

    we have found an issue in libsensors that occurs when parsing the chip address of ISA sensors resulting in an incorrect ISA address.

    The ISA sensor chip address of a sensor is obtained by parsing the
    "device" symlink of an hwmon device. The regular expression extracting
    the device address will fail if the "device" symlink contains dashes
    and sets the address to 0. If multiple instances of the same board are plugged into the same system, cards can no longer be distinguished, as
    they all will be incorrectly be assigned an address of 0.

    Example:
    const char* dev_name = "ucsi-source-psy-USBC000:001";
    int addr = -1;
    /* current regex */
    if (sscanf(dev_name, "%*[a-zA-Z0-9_]%*1[.:]%d", &addr) != 1)
    addr= 0;
    printf("addr: %d\n", addr); /* prints 0 */
    addr = -1;
    /* proposed regex */
    if (sscanf(dev_name, "%*[a-zA-Z0-9_-]%*1[.:]%d", &addr) != 1)
    addr= 0;
    printf("addr: %d\n", addr); /* prints 1 */


    We propose to add dashes to the regular expression, so that device
    names with dashes will be correctly recognized, and provide it as a
    patch. Note that we already opened an issue upstream at https://github.com/lm-sensors/lm-sensors/pull/529
    It seems though, that the package is abandoned for a few years now. It
    would be great if we could at least fix things in Debian.

    The original lm-sensors upstream is indeed dead. Debian and a few other distributions (Arch, SUSE, Gentoo, ...) have switched to a new upstream: https://github.com/hramrach/lm-sensors . You might want to submit your
    patch there (note that there have been changes the few lines around).

    If it doesn't get merged there, we can indeed take it as a Debian
    specific change.

    Regards
    Aurelien

    --
    Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://aurel32.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)