LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   not enough hash marks of the -h option of the rpm command (https://www.linuxquestions.org/questions/linux-newbie-8/not-enough-hash-marks-of-the-h-option-of-the-rpm-command-823351/)

password636 08-01-2010 05:21 AM

not enough hash marks of the -h option of the rpm command
 
Hi,

This seems a boring question, but I'm just curious. In the rpm manual,
Code:

-h, --hash
              Print 50 hash marks as the package archive is unpacked.  Use with -v|--verbose for a nicer display.

But actually, there're not enough hash marks when I'm installing a package. About 44 hash marks there...

Well, I just want to know where the `50 hash marks' are.

colucix 08-01-2010 06:08 AM

On my Opensuse box only 43 hashes are printed out. By the way, looking at the source code of RPM, in the function printHash you can see this line of code:
Code:

rpmcliHashesTotal = (isatty (STDOUT_FILENO) ? 44 : 50);
this tells if the condition is true, the value is 44, otherwise 50. The condition is
Code:

isatty (STDOUT_FILENO)
which tests if the file descriptor of the standard output is connected to a terminal. Hence every time you install from a terminal or a virtual console the hashes displayed on the terminal are 44. Instead, if you redirect the output of the rpm command to a file the hashes will be 50. For example:
Code:

$ rpm --test -Uvh package.rpm > file
$ cat file
Preparing...                ##################################################

These are exactly 50. I cannot explain the reason of this behavior... maybe we should ask to the rpm developers! ;)

Moreover, I will not investigate why on my system the hashes displayed on the terminal are 43! Anyway the source code could unlock the mystery as well.. :jawa:

knudfl 08-01-2010 06:16 AM

Depends which "man page" you read.
The old 'man rpm' from 1995 was probably never edited.

http://www.nordugrid.org/documents/r...everybody.html
QUOTE :
" h - print progress bar with hash-marks "

( Doesn't matter, if it's 40 or 50.)

Other information, rpm-4.7.0, Changelog line 66816 : ( 1996 )
"take advantage of ARCHIVESIZE (if present) when displaying hash marks"

The code is in a source file as some math expression, I guess.
And in the resultant binary rpm, inside an object ?
..

password636 08-01-2010 06:57 AM

Wow. Thank you guys. Help me a lot!


All times are GMT -5. The time now is 04:07 AM.