Message6613

Author tuck182
Recipients tuck182
Date 2011-08-24.23:08:20
SpamBayes Score 1.1928575e-10
Marked as misclassified No
Message-id <1314227300.98.0.611647527186.issue1793@psf.upfronthosting.co.za>
In-reply-to
Content
Doing a file.seek(N, 1) fails for files opened in read/write mode ("r+" or "rb+"). This first manifested for me with mutagen corrupting m4a files when writing tags.


Output from the attached script (on two different systems, Linux and OS-X) gives:

--- OS-X ---
$ python ./script/test-seek.py 
Python 2.6.1
Darwin Kernel Version 10.8.0: Tue Jun  7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64
No errors

$ jython ./script/test-seek.py 
Jython 2.5.2
Java HotSpot(TM) 64-Bit Server VM, 20.1-b02-384, Apple Inc.
Traceback (most recent call last):
  File "./script/test-seek.py", line 31, in <module>
    assert f.tell() == x, "before read: pos should be %d but was %d" % (x, f.tell())
AssertionError: before read: pos should be 253 but was 254


--- Linux ---
$ python script/test-seek.py 
Python 2.7.1+
#42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011
No errors

$ java -jar target/lib/jython-standalone-2.5.2.jar script/test-seek.py 
Jython 2.5.2
OpenJDK Server VM, 20.0-b11, Sun Microsystems Inc.
Traceback (most recent call last):
  File "script/test-seek.py", line 31, in <module>
    assert f.tell() == x, "before read: pos should be %d but was %d" % (x, f.tell())
AssertionError: before read: pos should be 253 but was 254
History
Date User Action Args
2011-08-24 23:08:21tuck182setrecipients: + tuck182
2011-08-24 23:08:20tuck182setmessageid: <1314227300.98.0.611647527186.issue1793@psf.upfronthosting.co.za>
2011-08-24 23:08:20tuck182linkissue1793 messages
2011-08-24 23:08:20tuck182create