views:

43

answers:

2

Hi. I am developing fuse fs at python (with fuse-python bindings). What method I need to implement that touch correctly work? At present I have next output:


$ touch m/My\ files/d3elete1.me 
touch: setting times of `m/My files/d3elete1.me': Invalid argument

File exists "d3elete1.me":


$ ls -l m/My\ files/d3elete1.me 
-rw-rw-rw- 1 root root 0 Jul 28 15:28 m/My files/d3elete1.me

Also I was trying to trace system calls:


$ strace touch m/My\ files/d3elete1.me
...
open("m/My files/d3elete1.me", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_LARGEFILE, 0666) = 3
dup2(3, 0)                              = 0
close(3)                                = 0
utimensat(0, NULL, NULL, 0)             = -1 EINVAL (Invalid argument)
close(0)                                = 0
...

As you see utimensat failed. I was trying to implement empty utimens and utime but its are not even called.

A: 

You must implement utimens and getattr. Not all the system calls necessarily map directly to the C calls you might be expecting. Many of them are used internally by FUSE to check and navigate your filesystem, depending on which FUSE options are set.

I believe in your case FUSE is preceding it's interpretation of utimesat to utimens, with a getattr check to verify that the requested file is present, and has the expected attributes.

Update0

This is a great coincidence. There is a comment below suggestion that the issue likes with the fact that FUSE does not support utimensat. This is not the case. I had the exact same traceback you've provided while using fuse-python on Ubuntu 10.04. I poked around a little, it would appear that the fuse-python 0.2 bindings are for FUSE 2.6, it may be that a slight change has introduced this error (FUSE is now at version 2.8). My solution was to stop using fuse-python (the code is an ugly mess), and I found an alternate binding fusepy. I've not looked back, and had no trouble since.

I highly recommend you take a look, your initialization code will be cleaner, and minimal changes are required to adapt to to the new binding. Best of all, it's only one module, and an easy read.

Matt Joiner
I have implemented getattr and utimens but utimens don't even is called during "touch" command. Here http://dumpz.org/21309/ is output of my debugger when I was running "touch".
Mykola Kharechko
The master branch of FUSE (the C library) doesn't contain the string `utimensat`. `utimensat` was standardized only in 2008; probably it's just too new to be implemented in FUSE.
Philipp
Here http://dumpz.org/21310/ I had posted traceback. It is problems of fuse-python package ;(
Mykola Kharechko
+1  A: 

Try launching fuse with the -f option. Fuse will stay in foreground and you can see errors in the console.

Markus Pielmeier
Thanks for this great hint! I don't know about it. It seems there is problem in fuse-python bindings - http://dumpz.org/21310/
Mykola Kharechko