Overview
Comment: | Added more reliable write support |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | tcl-ops |
Files: | files | file ages | folders |
SHA1: | d836b9fc4376f3a3e5cf4054f2a4866f147734f5 |
User & Date: | rkeene on 2014-11-07 13:19:35 |
Other Links: | manifest | tags |
Context
2014-11-08
| ||
19:33 | Removed SQLite dependency check-in: d74c945fc0 user: rkeene tags: tcl-ops | |
2014-11-07
| ||
13:19 | Added more reliable write support check-in: d836b9fc43 user: rkeene tags: tcl-ops | |
13:04 | Added validity checking for various types check-in: 5685a8f9a8 user: rkeene tags: tcl-ops | |
Changes
Modified appfsd.c from [5b32138d43] to [c5ca9c2598].
639 639 } else { 640 640 /* The file must already exist */ 641 641 if (gpi_ret != 0) { 642 642 return(gpi_ret); 643 643 } 644 644 645 645 mode = ""; 646 + 647 + if ((fi->flags & O_WRONLY) == O_WRONLY) { 648 + mode = "write"; 649 + } 646 650 } 647 651 648 652 if (pathinfo.type == APPFS_PATHTYPE_DIRECTORY) { 649 653 return(-EISDIR); 650 654 } 651 655 652 656 interp = appfs_TclInterp();
Modified appfsd.tcl from [25e6dbc0f2] to [6f6d010e1e].
476 476 477 477 return -code error "Invalid or unacceptable path: $dir" 478 478 } 479 479 480 480 proc getattr {path} { 481 481 array set pathinfo [_parsepath $path] 482 482 array set retval [list] 483 + 484 + catch { 485 + ::appfs::getindex $pathinfo(hostname) 486 + ::appfs::getpkgmanifest $pathinfo(hostname) $pathinfo(package_sha1) 487 + } 483 488 484 489 switch -- $pathinfo(_type) { 485 490 "toplevel" { 486 491 set retval(type) directory 487 492 set retval(childcount) 2; 488 493 } 489 494 "sites" { ................................................................................ 522 527 if {[info exists pathinfo(package_sha1)] && $pathinfo(package_sha1) != ""} { 523 528 set retval(type) directory 524 529 set retval(childcount) 2; 525 530 } 526 531 } 527 532 } 528 533 "files" { 534 + 529 535 set retval(packaged) 1 530 536 531 537 set localpath [_localpath $pathinfo(package) $pathinfo(hostname) $pathinfo(file)] 532 538 if {[file exists $localpath]} { 533 539 catch { 534 540 file lstat $localpath localpathinfo 535 541 set retval(time) $localpathinfo(mtime) ................................................................................ 580 586 } 581 587 582 588 set localpath [_localpath $pathinfo(package) $pathinfo(hostname) $pathinfo(file)] 583 589 584 590 if {[file exists $localpath]} { 585 591 return $localpath 586 592 } 593 + 594 + if {$mode == "create"} { 595 + return $localpath 596 + } 587 597 588 598 set work [split $pathinfo(file) "/"] 589 599 set directory [join [lrange $work 0 end-1] "/"] 590 600 set file [lindex $work end] 591 - set file_sha1 [::appfs::db onecolumn {SELECT file_sha1 FROM files WHERE package_sha1 = $pathinfo(package_sha1) AND file_name = $file AND file_directory = $directory;}] 601 + ::appfs::db eval {SELECT file_sha1, perms FROM files WHERE package_sha1 = $pathinfo(package_sha1) AND file_name = $file AND file_directory = $directory;} pkgpathinfo {} 592 602 593 - if {$file_sha1 == ""} { 603 + if {$pkgpathinfo(file_sha1) == ""} { 594 604 return -code error "No such file or directory" 595 605 } 596 606 597 - set localcachefile [download $pathinfo(hostname) $file_sha1] 607 + set localcachefile [download $pathinfo(hostname) $pkgpathinfo(file_sha1)] 598 608 599 - if {$mode == "create"} { 609 + if {$mode == "write"} { 600 610 set tmplocalpath "${localpath}.[expr rand()][clock clicks]" 601 - file copy -force -- $localcachefile $tmplocalpath 602 - file rename -force -- $tmplocalpath $localpath 611 + 612 + catch { 613 + file copy -force -- $localcachefile $tmplocalpath 614 + 615 + if {$pkgpathinfo(perms) == "x"} { 616 + file attributes $tmplocalpath -permissions +x 617 + } 618 + 619 + file rename -force -- $tmplocalpath $localpath 620 + } 621 + catch { 622 + file delete -force -- $tmplocalpath 623 + } 603 624 604 625 return $localpath 605 626 } 606 627 607 628 return $localcachefile 608 629 } 609 630 }