On 28/04/10 15:15, Avery Pennarun wrote:
> The patch is almost right, but you're missing a signed-off-by line.
>
Thanks - revised one attached. I had a bit of a fiddle with git am /
format-patch but didn't get very far.
> Also, do you want to see if you can catch the "filesystem
> initialization failed" exception and not print an ugly stack trace in
> that case? If you don't have time, I'll take a look at it later.
>
Tricky: it's thrown by f.main() rather than f.fuse_args.add. The
following works, but isn't pretty:
--- cmd/fuse-cmd.py 2010-04-28 15:44:33.000000000 +0100
+++ /usr/lib/bup/cmd/bup-fuse 2010-04-28 16:03:36.677703676 +0100
@@ -127,4 +127,11 @@
f.multithreaded = False
f.fuse_args.add('allow_other')
-f.main()
+try:
+ f.main()
+except fuse.FuseError:
+ f.fuse_args.optlist -= set(['allow_other'])
+ f.main()
I can't (easily) see a way of distinguishing this failure from others
(in this case the exception's args field matches ('filesystem
initialization failed',), but I expect it does for many other possible
failures). I don't know whether that message might be localized. The
stderr output of fusermount leaks out to the terminal:
"fusermount: option allow_other only allowed if 'user_allow_other' is
set in /etc/fuse.conf", which again might be localized. There does not
appear to be a convenience function for removing an option from the
arguments, and I'm not sure how acceptable it is for me to poke at the
optlist member as I have here.
Also something about the above causes "True" to be printed to the screen
(stdout this time) if the exception is caught. I've never really messed
with Python exceptions before so I'm not sure why.
In all cases where the exception is not caused by this particular
problem, you will get two sets of error messages e.g.
$ bup fuse ~/mnt
fuse: failed to open /dev/fuse: Permission denied
fuse: failed to open /dev/fuse: Permission denied
True
Traceback (most recent call last):
File "/usr/lib/bup/cmd/bup-fuse", line 134, in <module>
f.main()
File "/usr/lib/python2.6/dist-packages/fuse.py", line 754, in main
main(**d)
fuse.FuseError: filesystem initialization failed
or
$ bup fuse ~/mnt
fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the 'nonempty' mount option
fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the 'nonempty' mount option
True
Traceback (most recent call last):
File "/usr/lib/bup/cmd/bup-fuse", line 134, in <module>
f.main()
File "/usr/lib/python2.6/dist-packages/fuse.py", line 754, in main
main(**d)
fuse.FuseError: filesystem initialization failed
(so in fact, this patch really sucks :))