#958050 hd-idle: -a parameter behaviour not consistent with -t and with the manpage

Package:
hd-idle
Source:
hd-idle
Description:
Spin down idle [USB] hard disks
Submitter:
Bruno Gravato
Date:
2023-04-01 19:18:04 UTC
Severity:
minor
#958050#5
Date:
2020-04-17 19:59:51 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these template lines ***

This is a minor issue and probably coming from upstream, though I didn't
test for that.

hd-idle man page suggests that device names should be refered to without
the leading /dev/ in the name, which holds true for option -t, but not
for -a.

To test if hd-idle would successfuly spindown my disks I first tried to
run it with -t disk/by-id/ata-... which worked, when I added similar
option with -a to /etc/default/hd-idle it did not work, but it does if I
use -a /dev/disk/by-id/ata-...

If I add /dev/ to -t option it complains that device
/dev//dev/disk/by-id/ata-... does not exist.


By the way, I'm also using option -l /var/log/hd-idle.log, but no log is
being written to that file. The file isn't even created.
Some logs appear in /var/log/syslog, but only about the daemon
starting/stopping. There was no error/warning about non-existing devices
with option -a as it happens with -t if the device is invalid.


This is a minor issue, probably upstream, but made me waste some time
trying to figure out why -a in the conf file wasn't working as supposed
(and no clue in the logs regarding that). So I thought I'd report this
in case someone else bumps into the same issue.


Best regards,
Bruno Gravato

#958050#8
Date:
2023-03-27 14:54:04 UTC
From:
To:
Hi,

according to the source code, the option parser for -a tries to resolve
a symlink using a function disk_name(), the result is something like
sda, sdb sdc.  This function requires the full pathname including /dev.
The code handling the spindown timer then uses this short name (sda,
sdb, sdc) for further action.

The code handling the -t option does not use that disk_name() function,
but always puts a "/dev/" before the supplied disk name. This is why
you get the "/dev//dev/disk/by-id/ata-... does not exist" error.

So yes, this is indeed inconsistent and confusing.  Furthermore, the
device name lookup for -a does not report any errors when the device is
not found.

#958050#11
Date:
2023-03-27 15:00:14 UTC
From:
To:
Am Mon, Mar 27, 2023 at 16:54:04 +0200 schrieb Tino Mettler:

[...]
may be connected to the above behaviour: when using hd-idle -a
disk/by-id/..., the name lookup fails and hd-idle silently ignores the
device. In this case, nothing is written to the log file.

Regards,
Tino

#958050#16
Date:
2023-04-01 19:02:17 UTC
From:
To:
Hi,

according to the source code, the option parser for -a tries to resolve
a symlink using a function disk_name(), the result is something like
sda, sdb sdc.  This function requires the full pathname including /dev.
The code handling the spindown timer then uses this short name (sda,
sdb, sdc) for further action.

The code handling the -t option does not use that disk_name() function,
but always puts a "/dev/" before the supplied disk name. This is why
you get the "/dev//dev/disk/by-id/ata-... does not exist" error.

So yes, this is indeed inconsistent and confusing.  Furthermore, the
device name lookup for -a does not report any errors when the device is
not found.

#958050#21
Date:
2023-04-01 19:03:23 UTC
From:
To:
Am Mon, Mar 27, 2023 at 16:54:04 +0200 schrieb Tino Mettler:

[...]
may be connected to the above behaviour: when using hd-idle -a
disk/by-id/..., the name lookup fails and hd-idle silently ignores the
device. In this case, nothing is written to the log file.

Regards,
Tino