En Mon, 23 Mar 2009 21:37:14 -0300, R. David Murray <rdmur...@bitdance.com> escribió:
Steve Holden <st...@holdenweb.com> wrote:
Sreejith K wrote:
>> Try and write an example that shows the problem in fifteen lines or
>> less. Much easier for us to focus on the issue that way.
>
> import os
> def read(length, offset):
>    os.chdir('/mnt/gfs_local/')
>    snap = open('mango.txt_snaps/snap1/0','r')
>    snap.seek(offset)
>    data = snap.read(length)
>    print data
>
> read(4096,0)
>
> This code shows what actually happens inside the code I've written.
> This prints the 4096 bytes from the file '0' which is only 654 bytes.
> When we run the code we get the whole file. That's right. I also get
> it. But when this read() function becomes the file class read()
> function in fuse, the data printed is not the whole but only a few
> lines from the beginning.

This is confusing. I presume you to mean that when you make this
function a method of some class it stops operating correctly?

But I am not sure.

I am still struggling to understand your problem. Sorry,it's just a
language thing. If we take our time we will understand each other in the
end.

You may be asking this question for pedagogical reasons, Steve, but
in case not...the OP is apparently doing a 'less xxxx' where xxxx is
the name of a file in a fuse filesystem (that is, a mounted filesystem
whose back end is some application code written by the OP).
[...]
There are several steps between that 'snap.read' and less displaying on
the terminal whatever bytes it got back from its read call in whatever
way it is less chooses to display them....

And that's why everyone is asking for a *real* log. Assumptions like "foo must be 0 here" aren't enough. One needs *evidence*: a log file showing the value of "foo" right when it is used. Then, one can begin to infer what happens -- first step would be to determine *which* layer is (or is not) responsible for the misbehavior.

In this case, I'd like to see file.tell(), the requested size and the returned data length, *right*at*the*read()*call*.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to