@@ -157,12 +157,16 @@ db eval {CREATE INDEX IF NOT EXISTS packages_index ON packages (hostname, package, version, os, cpuArch);} db eval {CREATE INDEX IF NOT EXISTS files_index ON files (package_sha1, file_name, file_directory);} } proc download {hostname hash {method sha1}} { + ::appfsd::simulate_user_fs_leave + set url [_construct_url $hostname $hash $method] set file [_cachefile $url $hash] + + ::appfsd::simulate_user_fs_enter if {![file exists $file]} { return -code error "Unable to fetch (file does not exist: $file)" } @@ -472,11 +476,11 @@ if {$idx != -1} { set retval [lreplace $retval $idx $idx] } } - foreach file [glob -nocomplain -tails -directory $dir -types {d f l} {{.,}*}] { + foreach file [glob -nocomplain -tails -directory $dir -types {d f l p s} {{.,}*}] { if {$file == "." || $file == ".."} { continue } if {$file == ".APPFS.WHITEOUT"} { @@ -582,10 +586,18 @@ } "link" { set retval(type) "symlink" set retval(source) [file readlink $localpath] } + "fifo" { + # Capitalized so that the first char is unique + set retval(type) "Fifo" + } + "socket" { + # Capitalized so that the first char is unique + set retval(type) "Socket" + } } } err } else { if {![file exists $whiteoutpath]} { set retval(is_remotefile) 1 @@ -722,40 +734,33 @@ return -code error "invalid type" } set localpath $pathattrs(localpath) - set whiteout 0 - set isdirectory 0 if {[info exists pathattrs(is_localfile)]} { if {[file isdirectory $localpath]} { - set whiteout 1 + set children [getchildren $path] - set isdirectory 1 - set children [getchildren $path] + if {[llength $children] != 0} { + return -code error "Asked to delete non-empty directory" + } } + file delete -force -- $localpath } elseif {[info exists pathattrs(is_remotefile)]} { if {$pathattrs(type) == "directory"} { - set isdirectory 1 set children [getchildren $path] - } - set whiteout 1 + if {[llength $children] != 0} { + return -code error "Asked to delete non-empty directory" + } + } } else { return -code error "Unknown if file is remote or local !?" } - if {$isdirectory} { - if {$children != [list]} { - return -code error "Asked to delete non-empty directory" - } - } - - if {$whiteout} { - set whiteoutfile $pathattrs(whiteoutpath) - set whiteoutdir [file dirname $whiteoutfile] - file mkdir $whiteoutdir - close [open $whiteoutfile w] - } + set whiteoutfile $pathattrs(whiteoutpath) + set whiteoutdir [file dirname $whiteoutfile] + file mkdir $whiteoutdir + close [open $whiteoutfile w] } }