Bug 53976

Summary: another case of a corrupt HTTP download
Product: Sisyphus Reporter: Ivan Zakharyaschev <imz>
Component: aptAssignee: placeholder <placeholder>
Status: NEW --- QA Contact: qa-sisyphus
Severity: minor    
Priority: P5 CC: boyarsh, glebfm, imz, ldv, placeholder
Version: unstable   
Hardware: x86_64   
OS: Linux   
Attachments:
Description Flags
complete output of the testcase where it happened none

Description Ivan Zakharyaschev 2025-04-24 14:01:06 MSK
Created attachment 18292 [details]
complete output of the testcase where it happened

apt-0.5.15lorg2-alt92

Another case of getting corrupt downloads. Such cases are difficult to reproduce because they depend on random factors such the amount of bytes read by read() and are very rare. (If this happens, users should just retry.)

This time the downloaded file is "truncated" (size 0), because the download was broken after reading complete headers (with the ending empty newline) and then getting Read() = -1, as can be seen below in the debugging logs. (Probably, apt should have retried instead closing.)

(It's similar to what was described and fixed in: https://git.altlinux.org/gears/a/apt.git?p=apt.git;a=commit;h=ca3d6d01410fac8f1e8bb1cba33c1f32464e1b1b , but at a bit later moment of the download procedure.)

If this bug is (ever) paid attention to, it'd be interesting to test the potential fix by reproducing this case. One approach might be to use a wrapper class around MethodFd (like the wrapper for debugging and outputting the operations, whose output you see below), which would inject the Read() responses replaying the saved log. (A wrapper class is a more convenient and appropriate tool for this than an external utility like strace because there can be several layers of connections, all abstracted by MethodFd, e.g., inside TLS, TLS inside TLS to proxy, etc.)

W: Checksum mismatch of index file http://[::1]:8097/e2k/base/release.apt-tests: 786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce was supposed to be fcce94a0022fee04fe695b6d31ff175ad0fb8e752373cb62464ebcac6af2d99167a9e4e055eb42eca782775298d1fd0940e6c8d967776347392b91b948f60685
E: Failed to fetch http://[::1]:8097/e2k/base/release.apt-tests  Checksum mismatch


==> /tmp/sh.jsEtznlH/tmp.UqrVybUkZN/rootdir/var/lib/apt/lists/partial/::1:8097_e2k_base_release.apt-tests.FAILED <==
TINYPROXYLOG:



Write(621) ...

Write() = 621
GET http://[::1]:8097/e2k/base/release.apt-tests HTTP/1.1
Host: [::1]:8097
Cache-Control: max-age=86400
Proxy-Authorization: Basic Sm9obiBteUB1c2VyIG5hbWU6UDpzcyB3MHJk
User-Agent: RPM APT-HTTP/1.3

GET http://[::1]:8097/noarch/base/pkglist.apt-tests.xz HTTP/1.1
Host: [::1]:8097
Cache-Control: max-age=86400
Proxy-Authorization: Basic Sm9obiBteUB1c2VyIG5hbWU6UDpzcyB3MHJk
User-Agent: RPM APT-HTTP/1.3

GET http://[::1]:8097/noarch/base/release.apt-tests HTTP/1.1
Host: [::1]:8097
Cache-Control: max-age=86400
Proxy-Authorization: Basic Sm9obiBteUB1c2VyIG5hbWU6UDpzcyB3MHJk
User-Agent: RPM APT-HTTP/1.3


Fd() = 3

Fd() = 3

Fd() = 3

Fd() = 3

Fd() = 3

Fd() = 3

Fd() = 3

Fd() = 3

Fd() = 3

Read(65536) ...

Read() = 127
HTTP/1.1 200 OK
Via: 1.1 localhost.localdomain (tinyproxy/1.11.1)
Server: nginx/1.26.3
Date: Wed, 23 Apr 2025 20:29:42 GMT

Read(65409) ...

Read() = 40
Content-Type: application/octet-stream

Read(65369) ...

Read() = 21
Content-Length: 148

Read(65348) ...

Read() = -1

Fd() = 3

Fd() = 3

Fd() = 3

Fd() = 3

Fd() = 3

Fd() = 3

Fd() = 3

Fd() = 3

Fd() = 3

Fd() = 3

Fd() = 3

Fd() = 3

Read(65348) ...

Read() = 67
Last-Modified: Wed, 23 Apr 2025 20:29:39 GMT
ETag: "68094db3-94"

Read(65281) ...

Read() = 24
Accept-Ranges: bytes


Read(65257) ...

Read() = -1

Close() ...

Close() = 0