From 59e1ec541880faddb2a04181e861592ff3ebc72f Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Mon, 6 Nov 2017 17:53:37 -0700 Subject: [PATCH] ffi: Do not create plugins.scm inside dpkg-buildpackage's chroot. Otherwise the nearly empty file will be included in the package and unpacked during the installation, clobbering the existing list. --- src/ffi/build.scm | 54 ++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/src/ffi/build.scm b/src/ffi/build.scm index a4c1ab002..4eaef4923 100644 --- a/src/ffi/build.scm +++ b/src/ffi/build.scm @@ -45,32 +45,34 @@ USA. (update-html-index plugins scmdocdir)))) (define (updated-plugin-list operation plugin scmlibdir) - (let ((filename (string scmlibdir"plugins.scm"))) - (if (file-exists? filename) ;i.e. NOT in dpkg-buildpackage chroot - (rewrite-file - filename - (lambda (in out) - (cond ((eq? operation 'add) - (let ((new (cons plugin (delete! plugin (read in))))) - (write new out) - new)) - ((eq? operation 'remove) - (let ((new (delete! plugin (read in)))) - (write new out) - new)) - (else - (error "Unexpected plugin-list operation:" operation))))) - (cond ((eq? operation 'add) - (let ((new (list plugin))) - (call-with-exclusive-output-file - filename - (lambda (out) (write new out))) - new)) - ((eq? operation 'remove) - (warn "plugin list not found:" filename) - '()) - (else - (error "Unexpected plugin-list operation:" operation)))))) + (if (let ((filename (string scmlibdir"optiondb.scm"))) + (file-exists? filename)) ;i.e. NOT in dpkg-buildpackage chroot + (let ((filename (string scmlibdir"plugins.scm"))) + (if (file-exists? filename) + (rewrite-file + filename + (lambda (in out) + (cond ((eq? operation 'add) + (let ((new (cons plugin (delete! plugin (read in))))) + (write new out) + new)) + ((eq? operation 'remove) + (let ((new (delete! plugin (read in)))) + (write new out) + new)) + (else + (error "Unexpected plugin-list operation:" operation))))) + (cond ((eq? operation 'add) + (let ((new (list plugin))) + (call-with-exclusive-output-file + filename + (lambda (out) (write new out))) + new)) + ((eq? operation 'remove) + (warn "plugin list not found:" filename) + '()) + (else + (error "Unexpected plugin-list operation:" operation))))))) (define (delete-plugin-list) (let ((path (merge-pathnames "plugins.scm" -- 2.25.1