bugGNU Wget - Bugs: bug #43618, "bar" style progress...

 
 

bug #43618: "bar" style progress indicator never scrolls to the last character of a filename

Submitter:  Tom Li <biergaizi>
Submitted:  Sat 15 Nov 2014 10:37:03 AM UTC
   
 
Category:  User Interface Severity:  2 - Minor
Priority:  5 - Normal Status:  Fixed
Privacy:  Public Assigned to:  None
Originator Name:  Tom Li Open/Closed:  Closed
Release:  1.16 Operating System:  None
Reproducibility:  Every Time Fixed Release:  None
Planned Release:  1.16 Regression:  None
Work Required:  None Patch Included:  Yes
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 18 Nov 2014 01:02:46 PM UTC, comment #4: 

Thanks for quick responding.

In fact I didn't really understand the reason of "+1", but I finally realized it. I put it here for further references.


    orig_filename_cols - MAX_FILENAME_COLS

is the total number for scrolling.

When the filename appears for the first time, it won't be scrolled, so the total combinations is always one more than the total scrolls.

Tom Li <biergaizi>
Sun 16 Nov 2014 06:34:14 AM UTC, comment #3: 

I must say this is by far amongst the best bug reports I've seen!

Yes, we were aware of the issue, and it wasn't fixed because it was only a small aesthetic problem and I was too lazy.

Thanks a lot for providing the patch! I've added the ChangeLog entry and pushed it.

Darshit Shah <darnir>
Group administrator
Sat 15 Nov 2014 12:33:44 PM UTC, comment #2: 

So, to fix it, just replace

offset_cols = ((int) bp->tick) % (orig_filename_cols - MAX_FILENAME_COLS);

to

offset_cols = ((int) bp->tick) % (orig_filename_cols - MAX_FILENAME_COLS + 1);

Patch is attached.

(file #32439)

Tom Li <biergaizi>
Sat 15 Nov 2014 12:31:00 PM UTC, comment #1: 

To avoid the complexity of the progress bar implementation, let's use a simple Python script to verity the algorithm for text scrolling.

Note for non-Python programmers: both range(x, y) and string[x:y] are stand for [x, y).

FILENAME = "this_is_a_file_name"
MAX = 10

for i in range(0, 20):
    offset = i % (len(FILENAME) - MAX)
    print(offset, offset + MAX, FILENAME[offset:offset + MAX])

Output:

  1. 10 this_is_a_

1 11 his_is_a_f
2 12 is_is_a_fi
3 13 s_is_a_fil
4 14 _is_a_file
5 15 is_a_file_
6 16 s_a_file_n
7 17 _a_file_na
8 18 a_file_nam

  1. 10 this_is_a_


We can find a problem in the algorithm. To correct it,

-    offset = i % (len(FILENAME) - MAX)
+    offset = i % (len(FILENAME) - MAX + 1)

Output:

  1. 10 this_is_a_

1 11 his_is_a_f
2 12 is_is_a_fi
3 13 s_is_a_fil
4 14 _is_a_file
5 15 is_a_file_
6 16 s_a_file_n
7 17 _a_file_na
8 18 a_file_nam
9 19 _file_name

  1. 10 this_is_a_


Now the problem has been fixed.

Tom Li <biergaizi>
Sat 15 Nov 2014 10:37:03 AM UTC, original submission:  

When downloading files by using

$ wget --progress=bar http://example.com/this-is-a-very-long-filename.tar.xz

wget shows a scrolling progress indicator:

--2014-11-15 18:34:26-- 
http://example.com/this-is-a-very-long-filename.tar.xz
Resolving example.com... 127.0.0.1
Connecting to example.com|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 56020524 (53M) [application/octet-stream]
Saving to: ‘this-is-a-very-long-filename.tar.xz’

ng-filename.tar.x   0%[                                      ]

It never scrolls to the last character of the filename.

Tom Li <biergaizi>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by darnir (Posted a comment)
  • -email is unavailable- added by biergaizi (Submitted the item)
  •  

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-11-16 darnir Severity3 - Normal 2 - Minor
        StatusNone Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.16
        Patch IncludedNone Yes
    2014-11-15 biergaizi Attached File- Added fix-filename-display-for-progress-bar.patch, #32439

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code