snapcraft source progress bar crash on compressed source

Bug #1634538 reported by Chad Miller
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
New
Undecided
Unassigned

Bug Description

The download progress bar code assumes that the transfer size is the same as the disk size, which is true when the source is already compressed and doesn't compress better and the web server decides not to compress additionally.

Sources that use a URL might give a URL that compresses well, and when web servers tell the content length -- the size of the amount that will be transferred, the amount that is decompressed and written to disk is larger. That leads to the progress bar finish test to fail.

  File "/home/cmiller/work/canonical/snapcraft/snapcraft/internal/sources.py", line 139, in pull
    self.download()
  File "/home/cmiller/work/canonical/snapcraft/snapcraft/internal/sources.py", line 164, in download
    download_requests_stream(request, tmp_signature_filename)
  File "/home/cmiller/work/canonical/snapcraft/snapcraft/internal/indicators.py", line 53, in download_requests_stream
    progress_bar.update(total_read)
  File "/usr/lib/python3/dist-packages/progressbar/__init__.py", line 271, in update
    raise ValueError('Value out of range 0 <= %s <= %s' % (value, self.maxval,))
ValueError: Value out of range 0 <= 1295 <= 1074

You can't peek at the server header Content-Length and then take request data that has been decompressed for you.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.