Bug 620083 - whiptail --gauge does not work as advertised
whiptail --gauge does not work as advertised
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: newt (Show other bugs)
rawhide
All Linux
low Severity medium
: ---
: ---
Assigned To: Miroslav Lichvar
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-31 15:54 EDT by Joe Nuspl
Modified: 2010-08-06 08:24 EDT (History)
1 user (show)

See Also:
Fixed In Version: newt-0.52.12-1.fc15
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-08-06 08:24:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Simple patch to make the existing code work (317 bytes, patch)
2010-07-31 16:00 EDT, Joe Nuspl
no flags Details | Diff
Patch so behavior matches man page (759 bytes, patch)
2010-07-31 16:06 EDT, Joe Nuspl
no flags Details | Diff

  None (edit)
Description Joe Nuspl 2010-07-31 15:54:07 EDT
According to the whiptail manpage:

       --gauge text height width percent
              A gauge box displays a meter along the bottom of the box.  The
              meter indicates a percentage.  New percentages are read from
              standard input, one integer per line.  The meter is updated to
              reflect each new percentage.  If stdin is XXX, then subsequent
              lines up to another XXX are used for a new prompt.  The gauge
              exits when EOF is reached on stdin.

Running the following snippet does not change the text:

(
	echo 10
	sleep 5

	echo 20
	sleep 5

	echo XXX
	echo Replacement text
	echo XXX
	sleep 5

	echo 100
	sleep 1
) | whiptail --gauge "Original text" 10 40 0


# whiptail --version
whiptail (newt): 0.52.1
Comment 1 Joe Nuspl 2010-07-31 16:00:08 EDT
Created attachment 435793 [details]
Simple patch to make the existing code work

Looking at the code, I think the authors intent was for the first line after XXX to be the new percentage.  So the input would be of the form:

XXX
30
We're now at 30 percent complete.
XXX

I've attached a patch that makes it behave that way.
Comment 2 Joe Nuspl 2010-07-31 16:06:04 EDT
Created attachment 435794 [details]
Patch so behavior matches man page

The code as it exists does not match the behavior described in the man page.

My interpretation is that the input between XXX is just the text.  The input stream would be:

20
XXX
We're now at 20 percent complete.
XXX

This attached patch implements that behaviors.
Comment 3 Miroslav Lichvar 2010-08-02 05:49:42 EDT
Thanks for the patches. We are trying to be compatible with dialog, so the first one is actually correct.

I've pushed an updated patch (to 0.52.11) to the newt git repository and a man page description fix, so it's clear that after XXX should be a percentage.

This will be in newt-0.52.12.
Comment 4 Joe Nuspl 2010-08-02 14:17:08 EDT
Another issue:

sleep 5 | whiptail --gauge "multi\nline" 10 40 0

will display:

multi
 line

while dialog displays:

multi
line

With no leading space before line.
Comment 5 Miroslav Lichvar 2010-08-03 08:23:10 EDT
Should be fixed in git now. Thanks.

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