[issue13171] Bug in file.read(), can access unknown data.

2020-05-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13171] Bug in file.read(), can access unknown data.

2011-10-14 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

This issue has come up enough (tracker and python-list) that I think adding a 
mild adaptation of the C standard paragraph might be a good idea. Changing to a 
doc issue.

--
assignee:  -> docs@python
components: +Documentation -IO, Library (Lib), Windows
nosy: +docs@python, terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13171] Bug in file.read(), can access unknown data.

2011-10-14 Thread STINNER Victor

STINNER Victor  added the comment:

Le 14/10/2011 14:37, Alexander Steppke a écrit :
> "When a file is opened with update mode ('+' as the second or third character 
> in the above list of mode argument values),

You can just say " '+' in the file mode ".

> the fflush function or to a file positioning function (fseek, fsetpos, or 
> rewind),

You should translate these names into Python method names:
  fflush -> file.flush()
  fseek/fsetpos -> file.seek()
  rewind -> (not exposed in Python)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13171] Bug in file.read(), can access unknown data.

2011-10-14 Thread Alexander Steppke

Alexander Steppke  added the comment:

Thank you for the update Victor. It seems to me that this is exactly the same 
issue.

At the moment the current documentation says 
(http://docs.python.org/library/stdtypes.html#bltin-file-objects):

"Note: This function is simply a wrapper for the underlying fread() C function, 
and will behave the same in corner cases, such as whether the EOF value is 
cached."

This is a hint to the current behavior but I would not expect from this that 
file.read() can return any kind of data, if used directly after file.write(). 
Maybe one could include a link or a snippet of the C standard which states that 
one shall not do this:

"When a file is opened with update mode ('+' as the second or third character 
in the above list of mode argument values), both input and output may be 
performed on the associated stream. However, output shall not be directly 
followed by input without an intervening call to the fflush function or to a 
file positioning function (fseek, fsetpos, or rewind), and input shall not be 
directly followed by output without an
intervening call to a file positioning function, unless the input operation 
encounters end-of-file." 
 
(from http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf, page 272)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13171] Bug in file.read(), can access unknown data.

2011-10-14 Thread STINNER Victor

STINNER Victor  added the comment:

This issue is a duplicate of the issue #1394612 which has been closed as 
invalid. Read the following message:

http://bugs.python.org/issue1394612#msg27200

I suppose that Python 3 is not affected by this issue because it doesn't use 
fread/fwrite anymore, but directly read/write (the low level, unbuffered, API).

It looks like Python cannot do anything for this issue, except documenting this 
surprising behaviour. Would you like to write a patch for the documentation?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13171] Bug in file.read(), can access unknown data.

2011-10-14 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13171] Bug in file.read(), can access unknown data.

2011-10-14 Thread Alexander Steppke

Alexander Steppke  added the comment:

Additionally after calling tmp.close() the file 'tmp' contains the string 
'test', which is followed by about 4kB of binary data similar to the previous 
output of tmp.read().

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13171] Bug in file.read(), can access unknown data.

2011-10-14 Thread Alexander Steppke

Changes by Alexander Steppke :


--
components: +IO
title: Bug in tempfile module -> Bug in file.read(), can access unknown data.

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com