Package: python3 Version: 3.7.5-1 Severity: normal Dear maintainer,
I have a Python 3 program that tries to find one of the first lines in a log file after a certain timestamp. Sometimes something writes garbage data to the logfile causing my program to get inexplicably lost. After some investigation i have come up with the following program to reproduce the problem: from os import fstat, unlink from stat import ST_SIZE fn = "cr-1742ebb0-0172-11ea-b932-0ff8aa5102a4.txt" with open(fn, "w") as fh: fh.write("\r") with open(fn, errors='replace', encoding='utf8') as fh: print("File size: {}".format(fstat(fh.fileno())[ST_SIZE])) print(repr(fh.read(1))) print("{} position after readline: {}".format(type(fh), fh.tell())) unlink(fn) Running this program in the docker image debian:experimental after installing python3 gives the following output: File size: 1 '\n' <class '_io.TextIOWrapper'> position after readline: 1461501637671185285124623296198104371161410306049 Where i had expected a position no greater than the file size and and a character that exists in the file or a replacement marker. -- System Information: Debian Release: bullseye/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 4.19.0-6-amd64 (SMP w/8 CPU cores) Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: unable to detect Versions of packages python3 depends on: ii libpython3-stdlib 3.7.5-1 ii python3-minimal 3.7.5-1 ii python3.7 3.7.5-2 python3 recommends no packages. Versions of packages python3 suggests: pn python3-doc <none> pn python3-tk <none> pn python3-venv <none> -- no debconf information