This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients hathawsh, martin.panter, vstinner
Date 2016-08-20.00:31:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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:;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:52vstinnersetrecipients: + vstinner, hathawsh, martin.panter
2016-08-20 00:31:52vstinnersetmessageid: <>
2016-08-20 00:31:52vstinnerlinkissue27805 messages
2016-08-20 00:31:50vstinnercreate