On Tue, Nov 4, 2008 at 6:48 AM, Alex <[EMAIL PROTECTED]> wrote: > > As on update: > > I had already refrenced LoopbackFS heavily, but to be sure I ended up > copying the entire file and making changes from there. Creating a new > file now works from the command line and persists the data correctly > back to the server. However I can't seem to get modifying data on the > server to work correctly. > > From the command line I open a file on the filesystem using Vi. The > file contents are correctly displayed. The log shows that > a /.file.txt.swp is created. I then edit the file and save back the > changes. I get a warning telling me that the file has changed since > reading it. I choose to write anyway and the the program goes into an > infinite loop. The log file shows that its continualy getting the > attributes of increasing numbered files, such as /4913, /5036, ect. > > If I try echoing text into a file already on the filesystem I get a > permission denied message.
You should focus on fixing the latter issue first. Get these fundamental things working before you even try using vi: touch /Volumes/myfs/foo.txt echo "blah" > /Volumes/myfs/foo.txt chmod 777 /Volumes/myfs/foo.txt echo -n > /Volumes/myfs/foo.txt cp /tmp/bar /Volumes/myfs/foo.txt If echo'ing text into a file system like "echo "blah" > /Volumes/myfs/foo.txt" is failing, then: 1) Do you implement truncate and support it properly? 2) Are you returning proper write permissions in attributesOfItem: for that file? 3) Are you implementing openFileAtPath: properly? 4) Are you implementing writeFileAtPath: properly? Have you tried adding the "debug" option at mount time? You can use Console.app to view log messages or if you are running in xcode you can show the Console there while your FS is "running". Look for failed operations in the debug output. Somehow your file system is returning EPERM. This is returned by default in some cases within GMUserFileSystem if a delegate method is not implemented, so it could be related to that as well. ted > > Any ideas? > > On Oct 30, 4:37 pm, "ted bonkenburg" <[EMAIL PROTECTED]> wrote: >> On Thu, Oct 30, 2008 at 2:17 PM, Alex <[EMAIL PROTECTED]> wrote: >> >> > Thanks for the quick reply Ted. Sorry about the ambiguous post, it >> > kind of feels like I'm coding in the dark a little bit. >> >> > Here are a few more specifics: >> > 1. Mac OS X version: 10.5.5 >> > 2. arch (x86, ppc, x86_64, ppc64): x86 >> > 3. MacFUSE version: Latest (1.7) >> >> > I have implemented most of the delegate methods, except for the >> > extended attributes ones, mostly just to see if they were being >> > called. I don't set the fileDelegate in the createfile function, and >> > openfile is never called. >> >> > I tried using the command line operations and am getting the same >> > output in the log. I haven't messed around with it too much yet, I >> > will continue working on it tomorrow, I just wanted to get this >> > posted. Here is a list of delegates that I have implemented (and at >> > least compiling without errors). >> >> Thanks for the quick update. Compiling without errors is a start, but >> of course you'll need to have a proper implementation that returns the >> right error codes when appropriate, etc. It is not easy to help with >> something like this via email, so I'll let you spend a bit more time >> on it tomorrow before I hazard any guesses. >> >> You might want to look at the LoopbackFS file system. That has full >> write support, so at least you can see that it should work and maybe >> get an idea what it is doing. >> >> See LoopbackFS.m here: >> >> http://macfuse.googlecode.com/svn/trunk/filesystems-objc/LoopbackFS/ >> >> ted >> >> > attributesOfFileSystemForPath >> > attributesOfItemAtPath >> > contentsOfDirectoryAtPath >> > setAttributes >> > contentsAtPath >> > createDirectoryAtPath >> > createSymbolicLinkAtPath >> > linkPath >> > createFileAtPath >> > writeFileAtPath >> > truncateFileAtPath >> > movePath >> > removeFileAtPath >> > openFileAtPath >> > readFileAtPath >> > exchangeDataOfItemAtPath >> > moveItemAtPath >> > removeDirectoryAtPath >> > removeItemAtPath >> >> > Thanks for the help. >> >> > -Alex >> >> > On Oct 30, 4:42 pm, "ted bonkenburg" <[EMAIL PROTECTED]> wrote: >> >> See comments inline. Also, in the future, it might be useful to indicate: >> >> >> 1. Mac OS X version >> >> 2. arch (x86, ppc, x86_64, ppc64) >> >> 3. MacFUSE version >> >> >> On Thu, Oct 30, 2008 at 12:58 PM, Alex <[EMAIL PROTECTED]> wrote: >> >> >> > I've been having a lot of trouble creating a writable filesystem using >> >> > the objective-c framework. The filesystem is remote, the contents are >> >> > stored on a website. I have gotten reading to work fine, but getting >> >> > files to be written back has not been working, and I'm not entirely >> >> > sure where to go from here. I'm not sure if I'm not implementing a >> >> > function I need to be, or if I'm implementing one of the core >> >> > functions incorrectly. >> >> >> That is most likely the explanation. I'm being vague on purpose here >> >> because it is not easy to tell what the problem is without seeing the >> >> code. >> >> >> If you are doing a read-only file system you can often get away with >> >> leaving out implementations of some of the delegate methods; the >> >> GMUserFileSystem code will try to do something reasonable to fill in >> >> for you. >> >> >> When adding write support, you typically need to implement almost all >> >> of the delegate methods and have them return proper error codes, etc. >> >> Write support is almost all-or-nothing and not very forgiving, >> >> especially when it comes to operations done through the Finder. >> >> >> > What I want to be able to do is write that file over the server online >> >> > and have the file appear in the mounted filesystem. I'm assuming I >> >> > should put this logic in the writeFileAtPath function, but I haven't >> >> > been able to get this function to be called yet. >> >> >> writeFileAtPath will be called when data is being written to your >> >> file. However, other required delegate methods may be called by >> >> whatever is doing the file copy before this, and if they fail it may >> >> not even get to the point of writing the file. >> >> >> > Right now, I mount the filesystem and then try to copy and paste a new >> >> > file into the root directory of the filesystem. I put logging to know >> >> > what functions are being called. This is the output that I get: >> >> >> > In atts of item: /textDoc.txt >> >> > Item not found...: /textDoc.txt >> >> > In atts of item: / >> >> > In atts of item: /textDoc.txt >> >> > Item not found...: /textDoc.txt >> >> > In create file at path2 >> >> > In atts of item: /textDoc.txt >> >> > In atts of item: /._textDoc.txt >> >> > In atts of item: /textDoc.txt >> >> > In atts of item: /textDoc.txt >> >> > In atts of item: /._textDoc.txt >> >> > In create file at path2 >> >> > In atts of item: /._textDoc.txt >> >> > In atts of FS: / >> >> > In atts of FS: / >> >> > In atts of FS: / >> >> > In atts of FS: / >> >> > In contents of dir: / >> >> > In atts of FS: / >> >> > In atts of FS: / >> >> > In atts of FS: / >> >> > In atts of item: /Test.txt >> >> > In atts of item: / >> >> > In atts of FS: / >> >> > In atts of FS: / >> >> > In atts of item: /._Test.txt >> >> > In contents of dir: / >> >> > In atts of item: / >> >> > In atts of item: /._Test.txt >> >> > In atts of item: /aaaa.txt >> >> > In atts of FS: / >> >> > In atts of FS: / >> >> > In contents of dir: / >> >> > In atts of item: / >> >> > In atts of FS: / >> >> > In contents of dir: / >> >> > In atts of FS: / >> >> > In atts of item: /._Test.txt >> >> > In atts of item: /._Test.txt >> >> > In atts of item: /._aaaa.txt >> >> > In atts of item: /._Test.txt >> >> > In atts of item: /._Test.txt >> >> > In atts of item: /._Test.txt >> >> > In atts of item: /._aaaa.txt >> >> > In atts of item: /._aaaa.txt >> >> > In atts of item: /._Test.txt >> >> > In atts of item: / >> >> > In atts of FS: / >> >> > In atts of item: /._aaaa.txt >> >> > In atts of item: /._textDoc.txt >> >> > In atts of item: /._aaaa.txt >> >> > In atts of item: /._aaaa.txt >> >> > In atts of item: /._aaaa.txt >> >> > In atts of FS: / >> >> > In atts of item: /._textDoc.txt >> >> > In atts of item: /._aaaa.txt >> >> > In atts of item: /Test >> >> > In atts of item: /._textDoc.txt >> >> > In atts of item: /._textDoc.txt >> >> > In atts of item: /._Test >> >> > In atts of item: /Test2.txt >> >> > In atts of item: /._textDoc.txt >> >> > In atts of item: /._textDoc.txt >> >> > In atts of item: /._textDoc.txt >> >> > In atts of item: /._Test2.txt >> >> > In atts of item: /._Test >> >> > In atts of item: /._textDoc.txt >> >> > In atts of item: /._Test >> >> > In atts of item: /._Test2.txt >> >> > In atts of item: /._Test >> >> > In atts of item: /._Test2.txt >> >> > In atts of item: /._Test2.txt >> >> > In atts of item: /.hidden >> >> > In atts of item: /._Test2.txt >> >> > In atts of item: /._Test2.txt >> >> > In atts of item: /._Test2.txt >> >> > In atts of item: /.DS_Store >> >> > In atts of item: /.hidden >> >> > In atts of item: /.hidden >> >> > In atts of item: /._Test2.txt >> >> > In atts of item: /.DS_Store >> >> > In atts of item: /.DS_Store >> >> > In atts of item: /.hidden >> >> > In atts of item: /.DS_Store >> >> > In atts of FS: / >> >> > In atts of FS: / >> >> > In atts of FS: / >> >> > In atts of FS: / >> >> > In contents of dir: / >> >> > In atts of item: /._Test.txt >> >> > In atts of item: /._Test.txt >> >> > In atts of item: /._aaaa.txt >> >> > In atts of item: /._aaaa.txt >> >> > In atts of item: /._textDoc.txt >> >> > In atts of item: /._textDoc.txt >> >> > In atts of item: /._Test >> >> > In atts of item: / >> >> > In atts of item: /._Test2.txt >> >> > In atts of item: /._Test2.txt >> >> > In atts of item: /.DS_Store >> >> > In atts of item: /._aaaa.txt >> >> > In atts of FS: / >> >> > In atts of FS: / >> >> > In atts of item: /._textDoc.txt >> >> > In atts of FS: / >> >> > In atts of item: /._textDoc.txt >> >> > In atts of item: /._textDoc.txt >> >> > In atts of item: /._textDoc.txt >> >> > In contents at path /aaaa.txt >> >> > In atts of item: /._aaaa.txt >> >> > In atts of item: /._aaaa.txt >> >> > In contents at path /aaaa.txt >> >> > In atts of item: /._aaaa.txt >> >> > In atts of item: /._Test2.txt >> >> > In contents at path /Test2.txt >> >> > In atts of item: /._Test2.txt >> >> > In atts of item: /._Test.txt >> >> > In contents at path /Test.txt >> >> > In atts of item: /._Test.txt >> >> >> > At this point I get a message that says: "You cannot copy some of >> >> > these items to the destination because their names are too long or >> >> > contain invalid characters for the destination. Do you skip copying >> >> > these items and continue copying the other items?" >> >> >> This indicates to me that you are doing your test using the Finder. >> >> The Finder is extremely picky and performs a lot of write-like >> >> operations (chown, chmod, etc) for any given task. If any of these >> >> fails it will throw up an error message. In my experience, the error >> >> message it throws up is often misleading. It may complain about "names >> >> are too long" but probably in this case there is some other underlying >> >> error that it is seeing. >> >> >> My suggestion when implementing a write-able file system is to get >> >> things working with typical command-line operations first. Try things >> >> to test basic create, write, chmod, truncate, etc. like: >> >> >> touch /Volumes/myfs/foo.txt >> >> echo "blah" > /Volumes/myfs/foo.txt >> >> chmod 777 /Volumes/myfs/foo.txt >> >> echo -n > /Volumes/myfs/foo.txt >> >> cp /tmp/bar /Volumes/myfs/foo.txt >> >> >> Get these basics working first and then try to experiment with the >> >> Finder. You may still be missing something, but it might save you some >> >> headache and puzzling when you jump directly to attempting a >> >> Finder-compatible file system. >> >> >> > If I click skip I get the following: >> >> > In atts of item: / >> >> > In atts of FS: / >> >> > In contents of dir: / >> >> > In atts of item: /Test.txt >> >> > In atts of item: /._Test.txt >> >> > In atts of item: /._Test.txt >> >> > In atts of FS: / >> >> > In atts of item: /aaaa.txt >> >> > In atts of item: /._aaaa.txt >> >> > In atts of item: /._aaaa.txt >> >> > In atts of item: /textDoc.txt >> >> > In atts of item: /._textDoc.txt >> >> > In atts of item: /._textDoc.txt >> >> > In atts of item: /Test >> >> > In atts of item: /._Test >> >> > In atts of item: /Test2.txt >> >> > In atts of item: /._Test2.txt >> >> > In atts of item: /._Test2.txt >> >> > In atts of item: /.DS_Store >> >> > In atts of item: / >> >> > In atts of FS: / >> >> > In atts of item: /._aaaa.txt >> >> > In atts of FS: / >> >> > In atts of FS: / >> >> > In atts of FS: / >> >> ... >> >> read more ยป > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MacFUSE" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/macfuse?hl=en -~----------~----~----~----~------~----~------~--~---
