Comment 39 for bug 595138

Revision history for this message
Karl-Wilhelm Rips (charlykwr) wrote :

In Ubuntu 22.04.1 (jammy), package version `9.60+ds-1build3` of `hdparm` is
included. `hdparm.patch` (see #37) is included in this package (see file
`/usr/lib/hdparm/hdparm-functions`, lines 108 to 120). But this patch can't fix
the issue:

 1. Line 78:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    local WANTED_DISK="$1"
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Sets `WANTED_DISK` as configured in `/etc/hdparm.conf`, i.e.
    `/dev/disk/by-id/ata-…`.

 2. Lines 113 and 114:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    DISC=$(readlink -m "$KEY")
                                    DISC=${DISC%%[[:digit:]]*}
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Resolves symbolic link. `DISC` is now `/dev/sd…` for example.

 3. Lines 228 to 232:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                if [ -n "$OPTIONS" ] && [ "$DISC" = "$WANTED_DISK" ]
                                then
                                    echo $OPTIONS
                                    return 0
                                fi
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    If options for the disk have been set in `/etc/hdparm.conf` and `DISC` and
   `WANTED_DISK` are equal, the options are printed. But this will not happen
    because `DISC` contains resolved symbolic link (`/dev/sd…`) whereas
    `WANTED_DISK` contains original value according to `/etc/hdparm.conf`
    (`/dev/disk/by-id/ata-…`). Hence, they are not equal!

Therefore, `hdparm.patch` doesn't fix this issue.