Bug 435471 - sg_turs reports false number when --number and --progress given
sg_turs reports false number when --number and --progress given
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: sg3_utils (Show other bugs)
All Linux
medium Severity medium
: rc
: ---
Assigned To: Phil Knirsch
Depends On:
  Show dependency treegraph
Reported: 2008-02-29 10:55 EST by Milos Malik
Modified: 2015-03-04 20:19 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-03-20 05:30:24 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Milos Malik 2008-02-29 10:55:18 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; cs-CZ; rv: Gecko/20080208 Fedora/ Firefox/

Description of problem:
When sg_turs is executed with parameters "--progress" and "--number", it always reports "Completed 1 Test Unit Ready commands". It does not matter how big positive number is given to --number, it always reports the same message.

According to man page the utility should wait 30 seconds before subsequent checks when parameters "--number" > 1 and "--progress" are given, but the utility exits immediately.

When the parameter "--progress" is omitted, the reported number of completed TEST UNIT READY commands is correct.

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

How reproducible:

Steps to Reproduce:
1. sg_turs --number=1024 --progress /dev/sda
2. look at its output

Actual Results:
Its output is following:

Completed 1 Test Unit Ready commands

Expected Results:
Its output is following:

Completed 1024 Test Unit Ready commands

Additional info:
Comment 1 Dan Horák 2008-03-20 05:30:24 EDT
There is misunderstanding of the --progress option. It shows a progress of a
SCSI command for a busy device, not a progress of the whole test.

See the full explanation of the --progress option in the man page,
especially the "exits when" part:
"show progress indication (a percentage) if available.  If --number=NUM is given
and NUM is greater than 1 then waits 30 seconds before subsequent checks. Exits
when NUM is reached or there is no more progress indication. Ignores --time option."

Becuase in your test case the device is not busy with any operation, then there
can be no progress to show, so it exits immediately. You should see a "progress"
when trying the following commands:
sg_format --format /dev/foo ; sg_turs --progress --num=100 /dev/foo
the formatting makes the device busy and that's why it cannot respond as "ready"

This conclusion is a result of studying the source code and a consultation with
the upstream author.

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