[ python-Bugs-1488717 ] appended file on Windows reads arbitrary data
SourceForge.net
noreply at sourceforge.net
Mon May 15 18:58:26 CEST 2006
Bugs item #1488717, was opened at 2006-05-15 05:08
Message generated for change (Comment added) made by tim_one
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1488717&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
>Group: Not a Bug
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: muimi (muimi)
Assigned to: Nobody/Anonymous (nobody)
Summary: appended file on Windows reads arbitrary data
Initial Comment:
checked with versions 2.3 & 2.4.2 on Windows 2000 & XP
reading an appended file without resetting its
current position causes reading/writing of arbitrary data.
this appears to be related to the MS Visual Studio C
library.
def bug(filename):
af=open(filename,'a+')
af.write('\nlast line?')
print af.tell()
d=af.read() # this causes a read/write problem
print len(d), af.tell()
af.close()
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2006-05-15 12:58
Message:
Logged In: YES
user_id=31435
Yes, and this is inherited from the platform C library,
which conforms to the C standard in this respect: all
behavior is undefined if you read after write, or write
after read, without a file-positioning operation (typically
a seek) between them. So don't do that. Closing as not-a-bug.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1488717&group_id=5470
More information about the Python-bugs-list
mailing list