PyFilesystem / pyfilesystem

Python filesystem abstraction layer
http://pyfilesystem.org/
BSD 3-Clause "New" or "Revised" License
288 stars 63 forks source link

tahoe: setattr(st, key, val) TypeError: an integer is required #194

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
> What steps will reproduce the problem?
1. mount https://tahoe-lafs.org/trac/tahoe-lafs/wiki/TestGrid
2. find(1) over it

> What is the expected output?
File listing, as the dirs are accessible fine via the tahoe web interface.

> What do you see instead?
.
./Fractal_Cheetah_1_by_artofpain.jpg
./count
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/fs/expose/fuse/fuse_ctypes.py", line 333, in _wrapper_
    return func(*args, **kwargs) or 0
  File "/usr/lib64/python2.7/site-packages/fs/expose/fuse/fuse_ctypes.py", line 464, in readdir
    set_st_attrs(st, attrs)
  File "/usr/lib64/python2.7/site-packages/fs/expose/fuse/fuse_ctypes.py", line 282, in set_st_attrs
    setattr(st, key, val)
TypeError: an integer is required
./juice
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/fs/expose/fuse/fuse_ctypes.py", line 333, in _wrapper_
    return func(*args, **kwargs) or 0
  File "/usr/lib64/python2.7/site-packages/fs/expose/fuse/fuse_ctypes.py", line 464, in readdir
    set_st_attrs(st, attrs)
  File "/usr/lib64/python2.7/site-packages/fs/expose/fuse/fuse_ctypes.py", line 282, in set_st_attrs
    setattr(st, key, val)
TypeError: an integer is required
./mdmf
./Crypto Research
./Crypto Research/SODA10_101_goodrichm.pdf
./Crypto Research/How to Break MD5 and Other Hash Functions.pdf
./Crypto Research/timelock.pdf
./Crypto Research/Maurer02b.pdf
./Crypto Research/407.pdf
./Crypto 
Research/Carstensen-2011-Robust_Resource_Allocation_In_Distributed_Filesystem.pd
f
./Crypto Research/stebila.pdf
./TahoeGPG.key
./yllchi
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/fs/expose/fuse/fuse_ctypes.py", line 333, in _wrapper_
    return func(*args, **kwargs) or 0
  File "/usr/lib64/python2.7/site-packages/fs/expose/fuse/fuse_ctypes.py", line 464, in readdir
    set_st_attrs(st, attrs)
  File "/usr/lib64/python2.7/site-packages/fs/expose/fuse/fuse_ctypes.py", line 282, in set_st_attrs
    setattr(st, key, val)
TypeError: an integer is required

in the HEAD version it's quite the same except it hangs for a while and then
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/fs/expose/fuse/fuse3.py", line 293, in _wrapper_
    return func(*args, **kwargs) or 0
  File "/usr/lib64/python2.7/site-packages/fs/expose/fuse/fuse3.py", line 423, in readdir
    set_st_attrs(st, attrs)
  File "/usr/lib64/python2.7/site-packages/fs/expose/fuse/fuse3.py", line 238, in set_st_attrs
    setattr(st, key, val)
TypeError: an integer is required

> What version of the product are you using? On what operating system?
0.4.1.821 and HEAD on Gentoo.

Original issue reported on code.google.com by zl29ah@gmail.com on 15 Mar 2015 at 10:31

GoogleCodeExporter commented 9 years ago
Looks like Tahoe must be returning some 'c_stat' attribute which isn't in the 
expected integer format (but only for some files, not all of them).
Could you modify the 'set_st_attrs' function in fuse_ctypes.py (or fuse3.py 
depending on which version you're testing with) and change the bit that says:
            setattr(st, key, val)
to:
            try:
                setattr(st, key, val)
            except:
                print "Couldn't set %s attr %s to %s" % (type(key), key, val)

and then re-run your test?

Original comment by gc...@loowis.durge.org on 15 Mar 2015 at 12:19

GoogleCodeExporter commented 9 years ago
Couldn't set <type 'str'> attr st_size to None

Original comment by zl29ah@gmail.com on 15 Mar 2015 at 12:32

GoogleCodeExporter commented 9 years ago
Are you able to determine what size the files (or directories?) returning 
errors are *supposed* to have?

I've never even used Tahoe myself, but digging into the code, maybe 'getinfo' 
in fs/contrib/tahoelafs/__init__.py or '_info' in fs/contrib/tahoelafs/util.py 
needs some extra special-case code to correctly handle the 'size' attribute as 
returned from Tahoe?

Original comment by gc...@loowis.durge.org on 15 Mar 2015 at 1:03

GoogleCodeExporter commented 9 years ago
First of all, its tahoe-lafs itself that hangs. I don't know why.

The web interface reports size as "?", tho the files are opened fine :/

Original comment by zl29ah@gmail.com on 15 Mar 2015 at 2:28

GoogleCodeExporter commented 9 years ago
So perhaps this is a bug in tahoe-lafs then, which needs to be fixed there 
rather than in pyfilesystem? *shrug*

Original comment by gc...@loowis.durge.org on 15 Mar 2015 at 7:09

GoogleCodeExporter commented 9 years ago
Seems like a deliberate design decision on their side: 
https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2332

Original comment by zl29ah@gmail.com on 29 Mar 2015 at 11:48