[opensuse] sg_utils - sg_turs command in Leap broken or is my script broken?
I have this little script that shows my problem. It is broke or is sg_turs broken? #!/bin/bash sg_turs /dev/sr0 > /dev/null RDY=$? echo "RDY = ${RDY}" This script always says the sg_turs commands exit status is 0. Even with the door open and no disk installed. The man page for the sg_turs command says: EXIT STATUS The exit status of sg_turs is 0 when it is successful (e.g. in the case of a mechanical disk, it is spun up and ready to accept commands). For this utility the other exit status of interest is 2 corresponding to the "not ready" sense key. For other exit status values see the sg3_utils(8) man page. Is my script broken or is sg_turs broken in this regard? Thanks Mark -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Отправлено с iPhone
30 мая 2018 г., в 22:10, Mark Hounschell <markh@compro.net> написал(а):
I have this little script that shows my problem. It is broke or is sg_turs broken?
#!/bin/bash sg_turs /dev/sr0 > /dev/null RDY=$? echo "RDY = ${RDY}"
This script always says the sg_turs commands exit status is 0. Even with the door open and no disk installed.
Looking at (upstream) source code, return status can only be non-zero if option —progress is specified. I did not look whether return code actually reflects unit state in this case. Sounds like a bug.
The man page for the sg_turs command says:
EXIT STATUS The exit status of sg_turs is 0 when it is successful (e.g. in the case of a mechanical disk, it is spun up and ready to accept commands). For this utility the other exit status of interest is 2 corresponding to the "not ready" sense key. For other exit status values see the sg3_utils(8) man page.
Is my script broken or is sg_turs broken in this regard?
Thanks Mark
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 05/30/2018 04:16 PM, Andrei Borzenkov wrote:
Отправлено с iPhone
30 мая 2018 г., в 22:10, Mark Hounschell <markh@compro.net> написал(а):
I have this little script that shows my problem. It is broke or is sg_turs broken?
#!/bin/bash sg_turs /dev/sr0 > /dev/null RDY=$? echo "RDY = ${RDY}"
This script always says the sg_turs commands exit status is 0. Even with the door open and no disk installed.
Looking at (upstream) source code, return status can only be non-zero if option —progress is specified. I did not look whether return code actually reflects unit state in this case.
Sounds like a bug.
Thanks for taking a look Andrei. The return code when using —progress does in fact change the behavior but it returns 0 as soon as the door closes. As opposed to spun up and ready. I'll file another bug report against sg3_utils that will probably also just end up in the bit bucket. Regards Mark -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (3)
-
Andrei Borzenkov
-
Mark Hounschell
-
Mark Hounschell