On Tue, Apr 15, 2008 at 6:32 PM, David Zhao <[EMAIL PROTECTED]> wrote: > Yes! You are right on the money. The latest fixes got rid of the problem for > me. I can see why MacFUSE would send a read only handle for the synthesized > dot files.
Excellent. I'm glad this fixes things. > > Since my application depends on this fix, what is the recommended way for > me to deploy this? Should I distribute a version of MacFUSE framework that I > compile? I think it should be possible to embed MacFUSE.framework within your application bundle. This might take a bit of work to get right, but it is doable. The drawback is that the Objective-C framework can serve as a bit of insulation from the underlying MacFUSE implementation details. If you embed the Objective-C framework then it could break someday if someone updates MacFUSE Core to a new version. It would be a really bad idea to overwrite the existing /Library/Frameworks/MacFUSE.framework or distribute your own MacFUSE Core.dmg. That would create a lot of confusion, so please don't do that. ted > > Thanks, > > -David > > > > > On Apr 15, 2008, at 5:22 PM, ted bonkenburg wrote: > > > > On Tue, Apr 15, 2008 at 1:10 AM, David Zhao <[EMAIL PROTECTED]> wrote: > > > > > Ted, > > > > > > Thanks for the quick response. My delegate implements both > > > > > > finderFlagsAtPath: > > > and > > > iconDataAtPath: > > > > > > > Thanks, that is helpful. I think I know what the problem is, and I > > just checked a "fix" into the tree. It is maybe more of a workaround > > than a fix, but let me describe the problem first. > > > > On 10.4, the custom resources (finderFlags / iconData) were mainly > > intended for read-only filesystems. If your file system's open doesn't > > handle the AppleDouble then It essentially synthesizes the AppleDouble > > files (._ prefix) for you and handles open/reading of these files. The > > problem occurs when the Finder creates a new file and wants to see if > > it should create or update the corresponding AppleDouble file. If the > > AppleDouble file does not exist, then the Finder will create and write > > some data to one. If it does exist, then the Finder will try to open > > the existing one read-write and update it (actually, it tries to > > unlink first, but it is ok for that to fail). > > > > I expect that what is going on is that you are indicating that the > > file has a custom icon, which causes GMUserFileSystem to claim that > > the AppleDouble file exists on your behalf. The Finder then tries to > > open that file read-write, but since your FS isn't handling the > > AppleDouble then GMUserFileSystem is falling back to the synthesized > > one, which is read-only. > > > > The change I just checked in will have GMUserFileSystem hand out a > > read-write fileDelegate for the synthesized AppleDouble file. Again, > > this happens only if your file system does not explicitly handle these > > files. In this case, the Finder can write whatever it wants and the > > operation succeeds. However, since it is writing to the synthesized > > AppleDouble, all the writes are lost. In practice this might be fine. > > If you aren't explicitly handling AppleDouble then you probably don't > > care about what the Finder wants to write there; you just want your > > custom icon to show up when it is read. > > > > Can you try out the latest version in svn and let me know if that > > fixes your problem? You should be able to xcodebuild in > > "macfuse/core/sdk-objc/". > > > > ted > > > > > > > > > > My finderFlagsAtPath in turn calls attributesOfItemAtPath: on my > delegate > > > to determine if a custom icon is necessary. Here's the log again with > logs > > > from finderFlagsAtPath: > > > > > > > > > unique: 3, opcode: LOOKUP (1), nodeid: 1, insize: 56 > > > LOOKUP /._Project.tmproj > > > 2008-04-15 01:04:43.459 MyLog: attributesOfItemAtPath: /._Project.tmproj > > > 2008-04-15 01:04:43.460 MyLog: Cannot find /._Project.tmproj: NSError > > > "POSIX error: No such file or directory" Domain=NSPOSIXErrorDomain > Code=2 > > > 2008-04-15 01:04:43.460 MyLog: attributesOfItemAtPath: /Project.tmproj > > > 2008-04-15 01:04:43.461 MyLog: finderFlagsAtPath: /Project.tmproj > > > 2008-04-15 01:04:43.461 MyLog: attributesOfItemAtPath: /Project.tmproj > > > NODEID: 76 > > > > > > unique: 3, error: 0 (Unknown error: 0), outsize: 136 > > > unique: 2, opcode: OPEN (14), nodeid: 76, insize: 48 > > > 2008-04-15 01:04:43.465 MyLog: Failed to open /._Project.tmproj for read > > > write > > > 2008-04-15 01:04:43.465 MyLog: openFileAtPath /._Project.tmproj: (null) > > > 2008-04-15 01:04:43.465 MyLog: Error with open: NSError "POSIX error: No > > > such file or directory" Domain=NSPOSIXErrorDomain Code=2 > > > 2008-04-15 01:04:43.465 MyLog: finderFlagsAtPath: /Project.tmproj > > > 2008-04-15 01:04:43.465 MyLog: attributesOfItemAtPath: /Project.tmproj > > > unique: 2, error: 0 (Unknown error: 0), outsize: 32 > > > OPEN[479047296] flags: 0x2 /._Project.tmproj > > > unique: 0, opcode: READ (15), nodeid: 76, insize: 64 > > > READ[479047296] 4096 bytes from 0 > > > READ[479047296] 4096 bytes > > > unique: 0, error: 0 (Unknown error: 0), outsize: 4112 > > > unique: 1, opcode: READ (15), nodeid: 76, insize: 64 > > > > > > > > > > > > > > > > > > > > > On Apr 15, 2008, at 12:47 AM, ted bonkenburg wrote: > > > > > > > > > > > > > David, > > > > > > > > Can you tell me whether or not your delegate implements any of the > > > > following methods: > > > > > > > > finderFlagsAtPath: > > > > iconDataAtPath: > > > > URLOfWeblocAtPath: > > > > > > > > This might help me figure out what is going on. Thanks. > > > > > > > > ted > > > > > > > > On Tue, Apr 15, 2008 at 12:27 AM, David Zhao <[EMAIL PROTECTED]> > wrote: > > > > > > > > > > > > > > > > > > Forgot to add that I'm using MacFUSE 1.3.0 from the website, running > > > > > on Tiger 10.4 with the latest updates. > > > > > > > > > > After the log excerpt below, macfuse attempted to open the file, I'm > > > > > going to post here in case it's related: > > > > > > > > > > unique: 3, opcode: OPEN (14), nodeid: 85, insize: 48 > > > > > 2008-04-15 00:00:05.971 MyLog: Failed to open /._Project.tmproj for > > > > > read write > > > > > 2008-04-15 00:00:05.971 MyLog: Error with open: NSError "POSIX > error: > > > > > > > > > > No such file or directory" Domain=NSPOSIXErrorDomain Code=2 > > > > > 2008-04-15 00:00:05.971 MyLog: attributesOfItemAtPath: > /Project.tmproj > > > > > unique: 3, error: 0 (Unknown error: 0), outsize: 32 > > > > > OPEN[502444320] flags: 0x2 /._Project.tmproj > > > > > unique: 1, opcode: READ (15), nodeid: 85, insize: 64 > > > > > READ[502444320] 4096 bytes from 0 > > > > > READ[502444320] 4096 bytes > > > > > unique: 1, error: 0 (Unknown error: 0), outsize: 4112 > > > > > unique: 2, opcode: READ (15), nodeid: 85, insize: 64 > > > > > READ[502444320] 4096 bytes from 0 > > > > > READ[502444320] 4096 bytes > > > > > unique: 2, error: 0 (Unknown error: 0), outsize: 4112 > > > > > unique: 4, opcode: WRITE (16), nodeid: 85, insize: 4160 > > > > > WRITE[502444320] 4096 bytes to 0 > > > > > unique: 4, error: -13 (Permission denied), outsize: 16 > > > > > unique: 0, opcode: RELEASE (18), nodeid: 85, insize: 64 > > > > > RELEASE[502444320] flags: 0x2 > > > > > unique: 0, error: 0 (Unknown error: 0), outsize: 16 > > > > > > > > > > the open succeeded though it should have > > > > > > > > > > > > > > > > > > > > > > > > > On Apr 15, 2008, at 12:19 AM, David Zhao wrote: > > > > > > > > > > > > > > > > > > > > > I have this fuse filesystem written towards the ObjC API. I'm > running > > > > > > into this error where whenever I copy a file to the fuse volume > using > > > > > > Finder, Finder fails with a permissions error. However, I can > write to > > > > > > it using the command line without a problem. > > > > > > > > > > > > Taking a look at LoopbackFS, I'm pretty certain the right errors > have > > > > > > been returned. After turning on debug mode, I found that it's > failing > > > > > > while creating the resource fork. Here's the relevant log output: > > > > > > > > > > > > unique: 4, opcode: LOOKUP (1), nodeid: 1, insize: 54 > > > > > > LOOKUP /Project.tmproj > > > > > > 2008-04-15 00:00:05.926 MyLog: attributesOfItemAtPath: > /Project.tmproj > > > > > > 2008-04-15 00:00:05.928 MyLog: Cannot find /Project.tmproj: > NSError > > > > > > "POSIX error: No such file or directory" Domain=NSPOSIXErrorDomain > > > > > > Code=2 > > > > > > unique: 2, error: -2 (No such file or directory), outsize: 16 > > > > > > unique: 4, opcode: LOOKUP (1), nodeid: 1, insize: 54 > > > > > > unique: 0, opcode: CREATE (35), nodeid: 1, insize: 62 > > > > > > 2008-04-15 00:00:05.930 MyLog: createFileAtPath: /Project.tmproj > > > > > > 2008-04-15 00:00:05.935 MyLog: FUSE created file at: > /Project.tmproj > > > > > > 2008-04-15 00:00:05.939 MyLog: Successfully opened /Project.tmproj > for > > > > > > writing > > > > > > 2008-04-15 00:00:05.939 MyLog: attributesOfItemAtPath: > /Project.tmproj > > > > > > NODEID: 84 > > > > > > unique: 0, error: 0 (Unknown error: 0), outsize: 152 > > > > > > CREATE[502480288] flags: 0x202 /Project.tmproj > > > > > > > > > > > > -----------------> So far, this is correct, didn't find the file, > > > > > > created it. > > > > > > -----------------> Below looks very strange > > > > > > > > > > > > unique: 3, opcode: LOOKUP (1), nodeid: 1, insize: 56 > > > > > > LOOKUP /._Project.tmproj > > > > > > 2008-04-15 00:00:05.941 MyLog: > > > > > > attributesOfItemAtPath: /._Project.tmproj > > > > > > 2008-04-15 00:00:05.945 MyLog: Cannot find /._Project.tmproj: > NSError > > > > > > "POSIX error: No such file or directory" Domain=NSPOSIXErrorDomain > > > > > > Code=2 > > > > > > 2008-04-15 00:00:05.945 MyLog: attributesOfItemAtPath: > /Project.tmproj > > > > > > 2008-04-15 00:00:05.947 MyLog: attributesOfItemAtPath: > /Project.tmproj > > > > > > NODEID: 85 > > > > > > unique: 3, error: 0 (Unknown error: 0), outsize: 136 > > > > > > > > > > > > This is strange because the file: ._Project.tmproj does not exist, > my > > > > > > FUSE code detected and returned ENOENT when attributesOfItemAtPath > is > > > > > > called. However, instead of returning that failure, macfuse seemed > to > > > > > > have called attributesOfItemAtPath: /Project.tmproj instead and > > > > > > accepted response for that. > > > > > > > > > > > > Here's my attributesOfItemAtPath function: > > > > > > > > > > > > - (NSDictionary *) attributesOfItemAtPath: (NSString *) path > > > > > > error: (NSError **) error > > > > > > { > > > > > > ...... logic to translate fuse path to path on disk. > > > > > > > > > > > > if( realPath == nil ) > > > > > > { > > > > > > *error = [NSError errorWithPOSIXCode: ENOENT]; > > > > > > NSLog( @"Cannot find %@: %@", path, *error ); > > > > > > return nil; > > > > > > } > > > > > > > > > > > > return [[NSFileManager defaultManager] fileAttributesAtPath: > > > > > > realPath > > > > > > traverseLink: NO]; > > > > > > } > > > > > > > > > > > > > > > > > > any pointers will be greatly appreciated. > > > > > > > > > > > > -David > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "macfuse-devel" group. To post to this group, send email to macfuse-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/macfuse-devel?hl=en -~----------~----~----~----~------~----~------~--~---