Comment 1 for bug 1007093

Revision history for this message
Derek Higgins (derekh) wrote :

it looks like its bad to use a mixture of
file.seek and os.lseek

[derekh@laptop tmp]$ cat t.py
import os

body = open("testfile")

body.seek(0, os.SEEK_END)
body.seek(0)
os.lseek(body.fileno(), 0, os.SEEK_SET)

print body.read()

[derekh@laptop tmp]$ cat testfile
Hello World
[derekh@laptop tmp]$ python t.py
Hello World
Hello World

this sequence happens in the glance client on the stdin file object in
glance/client.py - _get_image_size
and
glance/common/client.py _seekable