Python-fuse Input/output Error
Contents |
Sign in Pricing Blog Support Search GitHub This repository Watch 35 Star 437 Fork 96 terencehonles/fusepy Code Issues 20 Pull requests 10 Projects 0 Wiki Pulse Graphs New issue Problems fusepy with getattr? #10 Closed darkfeline opened this Issue Feb 8, 2013 · 10
Fuse Bad Mount Point Input/output Error
comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 3 participants darkfeline commented Feb 8, 2013 I'm having trouble getting a basic FUSE up and running. I'm using python 3 and I did the 2to3 thing on fuse.py. When I tried a stat on the mount point, I get input output error. According to the mixin log, I'm pretty sure I've implemented getattr right. Perhaps I'm forgetting something? 2013-02-07 23:13:27,941 DEBUG @fuse.log-mixin -> getattr / (None,) 2013-02-07 23:13:27,943 DEBUG @fuse.log-mixin <- getattr {'st_mtime': 1360296806.2537441, 'st_size': 4096, 'st_atime': 1360296806.2537441, 'st_gid': 1003, 'st_uid': 1000, 'st_mode': 448, 'st_ctime': 1360296806.2537441, 'st_nlink': 4} Owner terencehonles commented Feb 10, 2013 I'm trying to figure out what your problem is, but you only gave some debugging output. Can you show what you have written? (code snippet or github gist/repo is fine too) BTW I would use pip and virtualenv when you are developing/testing. These tools make it a lot easier to consume packages (that way you wouldn't even have to run 2to3) after installing pip and virtualenv you can just write: virtualenv testing_dir cd testing_dir . bin/activate pip install fusepy python whatever_your_scripts_name_is darkfeline commented Feb 11, 2013 Yes, I am using virtualenv, but my package was originally python 3 before I began adding fuse support. Here's the file with the Operations: https://github.com/darkfeline/hitagiFS/blob/develop/src/hitagifs/mount.py I can confirm that getattr in my Operations subclass is returning the dict as in the debugging output above; I'm assuming from that point on fusepy handles passing it on to fuse. Oh wait, since fusepy is a single module, I just added it to my package (I kept the license in it, of course!) to avoid dependencies. I don't think that would be a problem, but maybe it is? EDIT: putting fusepy in my package isn't the problem (I didn't think it was, but I tried having it separate anyway). darkfeline commen
user-space file-system with Python. WORK IN PROGRESS Installing FUSE I'm using XUbuntu, so the installation instructions will be Debian/Ubuntu specific. And unspectacular: ~/fuse-test$ sudo apt-get install fuse Now, for some mounts. Using sshfs What is sshfs? sshfs is a popular FUSE filesystem that allows you to mount a directory from another host, using ssh as transport. First, let's prepare a directory to mount. ~/fuse-test$ ssh remotehost murat@remotehost:~$ mkdir test murat@remotehost:~$ touch test/testfile murat@remotehost:~$ exit For sshfs there's a package readily available in the Ubuntu apt mirrors. Also, https://github.com/terencehonles/fusepy/issues/10 we need a directory to mount to. ~/fuse-test$ sudo apt-get install sshfs ~/fuse-test$ mkdir mountpoint Now, we can mount the remote directory test from remotehost. ~/fuse-test$ sshfs remotehost:test mountpoint ~/fuse-test$ cat /etc/mtab | grep remotehost remotehost:test /home/murat/fuse-test/mountpoint fuse.sshfs rw,nosuid,nodev,user=murat 0 0 mtab is looking good. So, what's inside our mount? ~/fuse-test$ ls mountpoint testfile Cake for everyone! And unmount, using fusermount. ~/fuse-test$ fusermount -u http://mknecht.github.io/fuse-and-python/ temp-fuse/ Hello World FS Looking for an easy intermediate step to writing my own file system, I stumbled over the examples that are shipped with FUSE. In particular, there is the Hello World filesystem. Let's make that one work. The examples are contained in the development package for libfuse, so we install that. ~/fuse-test$ sudo apt-get install libfuse-dev ~/fuse-test$ ls /usr/share/doc/libfuse-dev/examples/ cusexmp.c fioclient.c fselclient.c fusexmp_fh.c hello_ll.c null.c fioc.c fsel.c fusexmp.c hello.c Makefile ~/fuse-test$ cp -r /usr/share/doc/libfuse-dev/examples ./ ~/fuse-test$ cd examples/ Compile it. ~/fuse-test/examples $ make cc -Wall -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse fusexmp.c -lfuse -o fusexmp # more make output here We can now go ahead and mount the filesystem. ~/examples $ ./hello ../mountpoint/ cd ../mountpoint/ ~/fuse-test/mountpoint$ ls hello ~/fuse-test/mountpoint$ cat hello Hello World! ~/fuse-test/mountpoint$ cd .. ~/fuse-test$ fusermount -u mountpoint Let's have a look at the available Python bindings. by the way: undefined reference to `fuse_main_real' Here you might encounter the following error. If you don't, skip ahead. cc -Wall -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -lfuse fusexmp.c -o fusexmp /tmp/ccUDCZVj.o: In function `main': fusexmp.c:(.text+0x677): undefined reference to `fuse_main_real' collect2: error: ld returned 1 exit status make: *** [fusexmp] Error 1 The issue has been documented
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us http://stackoverflow.com/questions/11141495/how-to-implement-close-call-in-fuse-python Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack http://ak-aureus.blogspot.com/2013/07/writing-fuse-file-system-using-python.html Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How to implement close call in FUSE input/output error Python up vote 2 down vote favorite 2 My FUSE based file-system is SQLite database backed. I am unable to close a "file". mymachine@ubuntu:~/Desktop/FUSE/dedup/myfs$ cat gump batman returnscat: gump: Input/output error cat: gump: Input/output error strace give following output: open("gump", O_RDONLY|O_LARGEFILE) = 3 fstat64(3, {st_mode=S_IFREG|0777, st_size=15, ...}) = 0 read(3, "batman returns", 32768) = 14 write(1, "batman returns", 14batman returns) = 14 read(3, 0x9e41000, 32768) = -1 python-fuse input/output error EIO (Input/output error) write(2, "cat: ", 5cat: ) = 5 write(2, "gump", 4gump) = 4 open("/usr/share/locale/locale.alias", O_RDONLY) = 4 fstat64(4, {st_mode=S_IFREG|0644, st_size=2570, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb773e000 read(4, "# Locale name alias data base.\n#"..., 4096) = 2570 read(4, "", 4096) = 0 close(4) = 0 munmap(0xb773e000, 4096) = 0 open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) write(2, ": Input/output error", 20: Input/output error) = 20 write(2, "\n", 1 ) = 1 close(3) = -1 EIO (Input/output error) write(2, "cat: ", 5cat: ) = 5 write(2, "gump", 4gump) = 4 write(2, ": Input/output error", 20: Input/output error) = 20 write(2, "\n", 1 ) = 1 close(1) = 0 close(2) = 0 exit_group(1) = ? Following is the Python code of major FUSE API implementation: def open(self, path, flags): print "open: trying to open %s" %path sefs = seFS() ret = sefs.search(path) print ret if ret is True: return 0 return -errno.ENOENT def create(self, path, flags=None, mode=None): print "trying to create %