@@ -648,10 +648,12 @@ if (uid >= 0) { retval += uid; retval++; } + APPFS_DEBUG("Looked up inode number for path=%s,uid=%i: %u", path, uid, retval); + return(retval); } /* * Cache Get Path Info lookups for speed @@ -667,10 +669,12 @@ if (pthread_ret != 0) { APPFS_DEBUG("Unable to lock path_info cache mutex !"); return(-1); } + + APPFS_DEBUG("Looking up cache entry for path=%s,uid=%lli...", path, (long long) uid); if (appfs_path_info_cache != NULL) { hash_idx = (appfs_get_path_inode(path, uid)) % appfs_path_info_cache_size; if (appfs_path_info_cache[hash_idx]._cache_path != NULL) { @@ -689,13 +693,13 @@ return(-1); } if (retval == 0) { - APPFS_DEBUG("Cache hit on %s", path); + APPFS_DEBUG("Cache hit on path=%s,uid=%lli", path, (long long) uid); } else { - APPFS_DEBUG("Cache miss on %s", path); + APPFS_DEBUG("Cache miss on path=%s,uid=%lli", path, (long long) uid); } return(retval); } @@ -1021,10 +1025,12 @@ pathinfo->inode = appfs_get_path_inode(path, -1); } else { pathinfo->inode = appfs_get_path_inode(path, fsuid); } + APPFS_DEBUG("Caching inode for path=%s,uid=%lli as %llu (packaged = %i)", path, (long long) fsuid, pathinfo->inode, pathinfo->packaged); + if (retval == 0) { appfs_get_path_info_cache_add(path, fsuid, pathinfo); } else { APPFS_DEBUG("error: Invalid type for \"%s\" from Tcl", path); } @@ -1213,14 +1219,16 @@ if (pathinfo.typeinfo.file.executable) { stbuf->st_mode |= 0111; } - if (pathinfo.typeinfo.file.suidRoot) { - changeOwnerToUserIfPackaged = 0; + if (pathinfo.packaged) { + if (pathinfo.typeinfo.file.suidRoot) { + changeOwnerToUserIfPackaged = 0; - stbuf->st_mode |= 04000; + stbuf->st_mode |= 04000; + } } if (pathinfo.typeinfo.file.worldaccessible) { stbuf->st_mode &= ~077; } @@ -1252,11 +1260,11 @@ retval = -EIO; break; } - if (pathinfo.packaged && changeOwnerToUserIfPackaged) { + if ((pathinfo.packaged && changeOwnerToUserIfPackaged) || (!pathinfo.packaged)) { stbuf->st_uid = appfs_get_fsuid(); stbuf->st_gid = appfs_get_fsgid(); stbuf->st_mode |= 0200; } @@ -2018,11 +2026,11 @@ #endif /** ** Add FUSE arguments which we always supply **/ - fuse_opt_add_arg(args, "-odefault_permissions,fsname=appfs,subtype=appfsd,use_ino,kernel_cache,entry_timeout=0,attr_timeout=0,big_writes,intr,hard_remove"); + fuse_opt_add_arg(args, "-odefault_permissions,fsname=appfs,subtype=appfsd,use_ino,direct_io,entry_timeout=0,attr_timeout=0,big_writes,intr,hard_remove"); if (getuid() == 0) { fuse_opt_parse(args, NULL, NULL, NULL); fuse_opt_add_arg(args, "-oallow_other");