[issue34904] Crash in ZipFile.close() when writing zip file to /dev/null

2018-10-05 Thread Erik Bray
Erik Bray added the comment: For the sake of completeness, same deal in pure C: $ cat devnul.c #include int main(void) { FILE *f = fopen("/dev/null", "w"); printf("tell() = %ld\n", ftell(f)); printf("write(\"abcdefgh\") = %zu\n", fwrite("abcdefgh", 1, 8, f)); printf("tell()

[issue34904] Crash in ZipFile.close() when writing zip file to /dev/null

2018-10-05 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Thanks Erik for the details. On Mac with master also it works like Cygwin. ./python.exe Python 3.8.0a0 (heads/master:6f85b826b5, Oct 4 2018, 22:44:36) [Clang 7.0.2 (clang-700.1.81)] on darwin Type "help", "copyright", "credits" or "license" for more

[issue34904] Crash in ZipFile.close() when writing zip file to /dev/null

2018-10-05 Thread Erik Bray
Erik Bray added the comment: On Cygwin the same tests give >>> f = open('/dev/null', 'wb') >>> f.seekable() True >>> f.write(b'abcdefgh') 8 >>> f.tell() 8 >>> f.seek(8) 8 >>> f.tell() 8 I would also try macOS if I could. But yes, I wonder if it's a Linux bug. -- __

[issue34904] Crash in ZipFile.close() when writing zip file to /dev/null

2018-10-05 Thread Erik Bray
Erik Bray added the comment: The regression was introduced by issue26039. It does seem to be Linux-specific with seek/tell on /dev/null. For example, I cannot reproduce the issue on Cygwin. -- ___ Python tracker

[issue34904] Crash in ZipFile.close() when writing zip file to /dev/null

2018-10-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This may be a Linux bug. The /dev/null file is seekable, but seek() doesn't work correctly for it. It is especially confusing for buffered files. seek() always returns 0 and reset the file position. >>> f = open('/dev/null', 'wb') >>> f.seekable() True >>>

[issue34904] Crash in ZipFile.close() when writing zip file to /dev/null

2018-10-05 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Is this specific to Linux? I can reproduce this on master branch on Ubuntu but there is no error on Mac OS with the master branch. -- nosy: +xtreak ___ Python tracker

[issue34904] Crash in ZipFile.close() when writing zip file to /dev/null

2018-10-05 Thread Erik Bray
New submission from Erik Bray : Not that there is any great reason to write a zip file to /dev/null, but I had some code that happened to do so which worked on Python 2.7, but at some point this broke: Python 3.8.0a0 (heads/master:fc7d1b3, Oct 5 2018, 09:49:57) [GCC 4.8.4] on linux Type "hel