Correct "-n" behaviour when going past 100% of "-s" size #26
Labels
No Label
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: a-j-wood/pv#26
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
Date: Wed, 31 Oct 2018 14:04:58 +0100
From: Marcel
Subject: pv -n -s - unexpected/wrong calculation
Hi Andrew,
I hope you don't mind if I approach you directly. I am not sure if it
is a bug or by design, but I found that pv does not behave as
expected.
Lets assume I would like to tar 200.000 bytes. If I set size=100000
and run pv like so:
tar cf - . | pv -n -s $size
I will get an output that looks for example like this simplified example:
10
40
90
100
90
40
10
And if i set size smaller than 100.000 pv would even go to negative numbers.
I actually had expected that values would simply go above 100(%) or
that pv would stop at 100 (maybe even raise a warning, if told so).
Maybe you could enlighten me in this matter?
Cheers,
Marcel
Date: Wed, 21 Nov 2018 19:59:14 +0000
From: Andrew Wood
To: Marcel
Subject: Re: pv -n -s - unexpected/wrong calculation
Thanks for your email - sorry for the delayed response.
I've not had a chance to have a look through the code, but what happens when
you don't use -n - does it show the same behaviour? Also which version of
PV are you using?
Date: Sat, 24 Nov 2018 22:45:51 +0100
From: Marcel
To: Andrew Wood
Subject: Re: pv -n -s - unexpected/wrong calculation
Hi Andrew,
thanks for your reply. Here is what I tried:
tar --xz -cf - . | pv --interval 0.5 -s 10000 | split -b 1G - /tmp/testme_
The size is way to small and as expected I got negative numbers with -n.
Without -n, I get the following:
^C47MiB 0:00:02 [3.38MiB/s] [=======================================================] 88801% ETA 0:00:00
So, the percentage also seems to be affected and ETA stays 0:00:00 all the time.
Hope that helps. If I can be of any further help, please do not hesitate and get back to me!
pv --version = 1.6.6
Cheers,
Marcel
Date: Sun, 28 Mar 2021 20:06:40 +0100
From: Andrew Wood
To: Marcel
Subject: Re: pv -n -s - unexpected/wrong calculation
My apologies for the exceptionally long delay here!
I've had another look and I can reproduce the problem with "-n", in that I
get negative numbers and general nonsense, but normal display mode works
fine for me (i.e. I get the right % values). I wouldn't expect ETA to do
anything sensible anyway.
I will add a note to the TODO to investigate the behaviour of "-n" when the
input byte count exceeds the value of "-s" since it is clearly wrong.
This is corrected in the next release after 1.6.20, and was due to some extra conditions in numeric mode that had been mistakenly copied from the visual progress display.