-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugs on OSX regarding extended attributes and file system updates #21
Comments
How does bindfs fail to start if I believe the second bug is the same as #7. Essentially bindfs would have to (1) monitor the source dir itself and (2) emit similar file change events in the mounted dir. (1) is doable but requires a fair bit of work to do completely and reliably, but I'm not aware of any way to do (2). There doesn't seem to be any API for sending such events in FUSE or elsewhere. I pondered "simulating" an approximation of the events in a comment in #7 but that didn't really work out either. |
Hi Martin, Here is the error I get:
If there is a way to get more precise debugging information, please let me know and I will provide further feedback. If anything the differences between xattrs under Linux, BSD, and OSX should be minimal and it must not be difficult to make this feature work. Most important multi-platform programs (including tar, dropbox and rsync) support syncing attributes among these seamlessly. I am not a system programmer, but if you guide me on how to debug the issue, I don't mind writing a few lines of code. Meanwhile, your suggestion on disabling xattr by default on OSX/HFS is probably the safe way to go. With regards to the second issue, I think you are right, it is probably a FUSE issue. I think I have even read about it somewhere before (lack of a general framework for FS notifications). The issue is that file systems differ in the way they handle even notification. For instance I don't think NFS has that mechanism implemented into it at all. But most local file systems get these capabilities through the operating system (on Linux, OSX, and Windows at least) have well-defined mechanisms for such that (see here for OSX's). How much access do the FUSE file systems have to the FS underlying FUSE? Is there any way bindfs can latch to these OS-specific APIs, without bothering to go through FUSE? |
You can do It may be useful to add print statements to print out When I once tried to get bindfs to work under Travis OS X, I got some compiler warnings about there apparently being an extra parameter to the xattr callbacks on OS X: https://travis-ci.org/mpartel/bindfs/builds/27010766#L791. Not sure what that is or what to do with it, but it might be a useful lead. On Linux there is no such warning. About the second issue: a FUSE FS is a regular userspace process and it has pretty much the same limitations i.e. no special access to the underlying FS or other kernel code. There's only the FUSE API and what it provides. I don't think there's any fundamental reason why FUSE couldn't have an API for sending file change events (just like NFS could in principle send them if it wanted). It's just a non-trivial amount of work to build and nobody's chosen to do it. |
Well, this is kind of funny: Error number 50 is a network error. See for yourself here. I have actually never compiled bindfs manually, as I always try the homebrew builds first. There I don't seem to get any warning. I am leaving town for a conference tomorrow, but once I am back I will follow up on this, and will produce the output for you |
By the way, I just rebuilt bindfs using homebrew with verbose on to see if I get any warning. Nothing of that kind. You can see the full output here. I wall try a manual build once I am back. |
The FUSE library might talks to the kernel over some kind of socket, so a protocol error there being signalled with a "network error" might make sense. Compiling bindfs manually should be fairly easy: download and extract the .tar.gz, |
I'm back, @mpartel! I compiled bindfs with debugging on, and then tested different cases and recorded the debug log for you. You can find the outputs in this gist. The files are pretty large, so Github fails to display them properly. You will have to clone the gist to your computer instead. New finding: Unlike at the startup time, if I run bindfs manually from the command line it manages to mount successfully regardless of Below is a list of output files with some description.
The error dialogue referencing error -50. This particular one showed up when I was trying to duplicate a file in the mounted directory.
This is Below is the list of bindfs debug output logs. In each of the below cases the file with
Running bindfs with the normal options I have found stable over time (which means xattrs are disabled).
Running bindfs with the normal options I have found stable over time, except leaving xattrs enabled.
Running bindfs with the minimum working options (all options removed except the one that disables xattrs).
Running bindfs with no options (xattrs are left enabled). |
Thanks for the thorough logs. I still don't have a solid explanation for why the error code is -50 instead of the -93 that bindfs returns to FUSE. The function signature mismatch that the compiler warns about seemed fishy though, so I looked at that in some more detail. It finally occurred to me to look at the example code that comes with osxfuse. I copied over their (horribly verbose) Apple-specific implementations and pushed them to the mac-xattrs branch (diff). Could you give that branch a try? Without a mac I couldn't check if it even compiled, so you may need to make some small tweaks. |
Great job! Now bindfs can read the xattrs it seems (I actually only tried comments and they worked). Writing back the xattrs to disk seems to be still broken. I don't receive the error dialog anymore, and in the debug log we can see error -93 now. I had to make some minimal changes to the file for it to compile. I have made a pull request on the branch for you to see. All the build outputs and the debug log are here: https://gist.github.com/retrography/228eb420522e60a6b88d I guess it needs only one more push! |
Thanks! Strange, not sure what's wrong with setting xattrs. I didn't see any setxattr calls in your debug log. Would you like to investigate that further or shall I put out a release? |
Let me run it once again. This time I make sure I mark where xattr setter is invoked. |
I did a thorough investigation of the matter this time. Overall, The situation with comment xattr is pretty fishy though... When mounting a folder with bindfs, OSX finder does not display the comments saved in the file metadata at all. But more interestingly, it does not display correctly the comments on the source directory's files either, unless they have been directly set through it. I explain: A user can access file metadata in OSX at three levels:
When setting So, I think most of the job is done. Setting and getting xattrs seems to work correctly. But that doesn't mean bindfs is working nicely on OSX. The main remaining issues are:
I have uploaded a partial debug log from bindfs as well as a bunch of outputs from xattr and mdls in this gist. I continue investigating the matter to see what causes these behaviors - specially why the xattrs are not reported by mdls on mounted volumes. By the way, I read osxfuse's documentation once again and came up with the following switches for a working solution. Some of them are directly related to xattrs, and the xattrs wouldn't work as well without using them. For instance
|
As recommended by @retrography in #21.
Great, thanks! I added the options you mentioned to the man page and the readme and released 1.12.7. |
Thank you for all this work! |
By the way, you may (or may not) want to add in the readme/man files that while tagging works properly now, some xattrs like comments may still show inconsistent behavior due to OSX's peculiarities. It took me a while to understand that my issues emanated from running bindfs on OSX. Others don't have to repeat the same experiments. |
Good idea, done (for the next release). |
I have been using bindfs on OSX for a while now, and there seems to be two lingering and daunting bugs in the way bindfs works on OSX, mounting folders from hfs+ partitions:
Extended file attributes won't work. Unless
xattr-none
option is mentioned in the mount command, bindfs will fail to start. This is quite problematic given that without xattr, OSX keeps creating dot files to save its badly needed metadata.Also, file system updates go often undetected by bindfs, meaning that a file added to or deleted from the folder monitored and mounted (to another address) with bindfs is not detected.
I grouped these two issues here, because I figured out second issue may also have to do with handling file attributes. Don't hesitate to separate the two issues if this is not the case.
The text was updated successfully, but these errors were encountered: