diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2025-01-07 19:23:29 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2025-01-09 09:57:19 +0100 |
commit | cdd53cb74b0882ed2a249117c895b94013fa6ea9 (patch) | |
tree | f1e865b10756230a6066fdda1584f8c0b610186e /test | |
parent | fmf: Use different heuristic for number of process with many CPUs (diff) | |
download | systemd-cdd53cb74b0882ed2a249117c895b94013fa6ea9.tar.xz systemd-cdd53cb74b0882ed2a249117c895b94013fa6ea9.zip |
sd-device: make sd_device_new_from_path() accept relative path to device node
Even though udevadm accepts relative syspath, previously, udevadm
could not use relative path to device node:
===
$ cd /dev
$ udevadm info sda
Bad argument "sda", expected an absolute path in /dev/ or /sys/ or a unit name: Invalid argument
$ udevadm info /usr/../dev/sda
Unknown device "/usr/../dev/sda": No such device
===
With this change, both the above cases work fine.
Note, still sd_device_new_from_devname() requires absolute path starts
with /dev/, for safety.
Diffstat (limited to 'test')
-rwxr-xr-x | test/units/TEST-17-UDEV.10.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/units/TEST-17-UDEV.10.sh b/test/units/TEST-17-UDEV.10.sh index afa05909c4..e38291bdde 100755 --- a/test/units/TEST-17-UDEV.10.sh +++ b/test/units/TEST-17-UDEV.10.sh @@ -103,6 +103,11 @@ udevadm info -e --initialized-nomatch >/dev/null # udevadm info -c udevadm info -w /sys/class/net/$netdev udevadm info --wait-for-initialization=5 /sys/class/net/$netdev +pushd /dev +udevadm info null >/dev/null +udevadm info ./null >/dev/null +popd +udevadm info /usr/../dev/null >/dev/null udevadm info -h assert_rc 124 timeout 1 udevadm monitor |