Bug 435275 - sg_read_long returns bad exit status
Summary: sg_read_long returns bad exit status
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: sg3_utils
Version: 5.1
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Dan Horák
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2008-02-28 14:18 UTC by Milos Malik
Modified: 2009-09-02 11:23 UTC (History)
3 users (show)

Clone Of:
Last Closed: 2009-09-02 11:23:25 UTC

Attachments (Terms of Use)
Patch to fix return values for sg_read_long (720 bytes, text/x-patch)
2008-02-29 11:26 UTC, Phil Knirsch
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2009:1357 normal SHIPPED_LIVE sg3_utils bug fix and enhancement update 2009-09-01 10:51:52 UTC

Description Milos Malik 2008-02-28 14:18:46 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; cs-CZ; rv: Gecko/20080208 Fedora/ Firefox/

Description of problem:
Even if the command is not supported on the device the utility returns exit code 0. Other utilities in the sg3_utils package return exit code 9 when the command is not supported.

sg_read_long: issue read long (16) to device /dev/sda
    xfer_len=520 (0x208), lba=0 (0x0), correct=0
  SCSI READ LONG (16) command not supported

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. sg_read_long --16 /dev/sda
2. echo $?

Actual Results:
exit status is 0

Expected Results:
exit status is 9

Additional info:

Comment 1 Phil Knirsch 2008-02-28 14:32:18 UTC
Just reviewed the source, the return code handling is done incorrectly in
sg_read_long. Fix should be easy, so giving Devel ACK and flagging as exception
for RHEL-5.2 (not really a blocker as the tool still works on supported machines).

Thanks for spotting it Milos.

Read ya, Phil

Comment 2 Phil Knirsch 2008-02-29 11:26:32 UTC
Created attachment 296328 [details]
Patch to fix return values for sg_read_long

Comment 3 Phil Knirsch 2008-02-29 11:27:28 UTC
Bugfix attached, tests here show it works nicely:

[root@hamburg ~]# sg_read_long --16 /dev/sda
sg_read_long: issue read long (16) to device /dev/sda
    xfer_len=520 (0x208), lba=0 (0x0), correct=0
  SCSI READ LONG (16) command, bad field in cdb
[root@hamburg ~]# echo $?

Read ya, Phil

Comment 5 RHEL Product and Program Management 2008-07-21 23:05:58 UTC
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".

Comment 11 errata-xmlrpc 2009-09-02 11:23:25 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.