Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible regression in sg_pt_freebsd.c:scsi_pt_open_flags() #65

Open
AMDmi3 opened this issue Feb 16, 2021 · 1 comment
Open

Possible regression in sg_pt_freebsd.c:scsi_pt_open_flags() #65

AMDmi3 opened this issue Feb 16, 2021 · 1 comment

Comments

@AMDmi3
Copy link

AMDmi3 commented Feb 16, 2021

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 d82f040, there's now a stat(2) call on a specified path:

if (stat(device_name, &a_stat) < 0) {

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.

@doug-gilbert
Copy link
Contributor

Thanks for the report. I will try to undo the regression. The fix should be in svn revision 877 and it the soon to be released sg3_utils-1.46 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants