Commit4fdef9afRecorded23 Nov 2026Repositoryoriel
Restore template file modes in the portable runtime
Message
The portable runtime starts from the released template archive, which keeps no Unix modes, and the packager reset modes only for the files it replaced. libexec/sigil-runtime-remove therefore shipped as 0600, and uninstall failed with "A recorded runtime is busy or changed" whenever an older runtime was recorded, such as after upgrading from 0.1.2.
Restore each template file's recorded mode after its hash check, and refuse a package whose bin/ or libexec/ programs are not 0700.
Changed
scripts/portable/package-release-candidate.sgl | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)Diff
scripts/portable/package-release-candidate.sglmodified
@@ -60,7 +60,11 @@
60
(when (eq? (car row) 'file) 61
(define file (path tree (cadr row))) 62
(unless (= (file-size file) (cadddr row)) (error "Release template length changed" file))−63
(require-hash file (list-ref row 4))))+63
(require-hash file (list-ref row 4))+64
;; The archive keeps no Unix modes, so unzip extracts every file without+65
;; execute permission. Restore the mode the released manifest recorded, or+66
;; kept programs such as libexec/sigil-runtime-remove would ship unrunnable.+67
(set-file-mode! file (caddr row)))) 68
(define source-assets (path source "packages/oriel/assets")) 69
(directory-walk source-assets 70
(lambda (file type)@@ -236,6 +240,12 @@
240
(define runtime (make-host-runtime-tree tree "oriel" "libexec/oriel-launch")) 241
(define artifact (path work "oriel")) 242
(write-text (path work "CANDIDATE-RUNTIME.sgl") (runtime-tree-manifest runtime))+243
;; Every program in bin/ and libexec/ must stay executable by its owner.+244
(each row (cdr (assq 'entries (cdr (datum (path work "CANDIDATE-RUNTIME.sgl")))))+245
(when (and (eq? (car row) 'file)+246
(or (starts-with? (cadr row) "bin/") (starts-with? (cadr row) "libexec/"))+247
(not (= (caddr row) #o700)))+248
(error "Runtime program is not executable" (cadr row) (caddr row)))) 249
(write-text (path work "RUNTIME.KEY") (runtime-tree-cache-key runtime)) 250
(write-runtime-bundle! runtime launcher artifact) 251
(seal! "PACKAGE.sgl"