This was reported long time ago in FreeBSD bug tracker, user complains that sg_persist -i -s da0 (e.g. called on device name as opposed to full path /dev/da0) stopped working after update from 1.42 to 1.44. This may be a regression introduced by d82f040c69689305ca1d318d3dc0e1e42ab6ffa3, there's now a stat(2) call on a specified path:
which requires a valid path, however the device name is later passed to cam_get_device(3) which performs additional parsing
cam_get_device() takes a path argument containing a string with a device
name followed by a unit number. It then breaks the string down into a
device name and unit number, and passes them back in dev_name and unit,
respectively. cam_get_device() can handle strings of the following
forms, at least:
/dev/foo1
foo0
nsa2
cam_get_device() is provided as a convenience function for applications
that need to provide functionality similar to cam_open_device().
My guess here is that the current logic which expects raw path no longer allows to specify a unit number, and maybe cam_get_device should be called early to split dev name first which can be then passed to stat and other checks.
Note that I don't use sg3_utils, just conveying a potential problem.
This was reported long time ago in FreeBSD bug tracker, user complains that
sg_persist -i -s da0
(e.g. called on device name as opposed to full path/dev/da0
) stopped working after update from 1.42 to 1.44. This may be a regression introduced by d82f040c69689305ca1d318d3dc0e1e42ab6ffa3, there's now astat(2)
call on a specified path:https://github.com/hreinecke/sg3_utils/blob/d82f040c69689305ca1d318d3dc0e1e42ab6ffa3/lib/sg_pt_freebsd.c#L185
which requires a valid path, however the device name is later passed to
cam_get_device(3)
which performs additional parsingMy guess here is that the current logic which expects raw path no longer allows to specify a unit number, and maybe cam_get_device should be called early to split dev name first which can be then passed to
stat
and other checks.Note that I don't use sg3_utils, just conveying a potential problem.