Message273171
Syscalls made by open("/dev/stdout", "a") in Python 2:
open("/dev/stdout", O_WRONLY|O_CREAT|O_APPEND, 0666) = 3
lseek(3, 0, SEEK_END) = -1 ESPIPE (Illegal seek)
fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
I used this comand:
$ strace -o trace python2 -c 'import os; os.uname();os.uname();os.uname(); f=open("/dev/stdout", "a"); os.uname(); f.close()'
It looks like the C library simply ignores ESPIPE on lseek(fd, 0, SEEK_END) when opening a file in append mode:
https://sourceware.org/git/?p=glibc.git;a=blob;f=libio/fileops.c;h=13157354272ff9ab1832d4a619a81f05898fcd69;hb=HEAD#l242
if ((read_write & _IO_IS_APPENDING) && (read_write & _IO_NO_READS))
if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT)
== _IO_pos_BAD && errno != ESPIPE)
{
close_not_cancel (fdesc);
return NULL;
}
from _IO_file_open() file operation. |
|
Date |
User |
Action |
Args |
2016-08-20 00:31:52 | vstinner | set | recipients:
+ vstinner, hathawsh, martin.panter |
2016-08-20 00:31:52 | vstinner | set | messageid: <1471653112.08.0.164157719557.issue27805@psf.upfronthosting.co.za> |
2016-08-20 00:31:52 | vstinner | link | issue27805 messages |
2016-08-20 00:31:50 | vstinner | create | |
|