From db1b18c397fb2f9892ebce82bbea5998ce27fbb4 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 6 Nov 2020 21:42:39 +0100 Subject: ui: Add missing format argument in 'warn-about-load-error'. * guix/ui.scm (warn-about-load-error): Add missing argument to 'warning'. --- guix/ui.scm | 1 + 1 file changed, 1 insertion(+) (limited to 'guix') diff --git a/guix/ui.scm b/guix/ui.scm index 8d7bc238bc..d5327a5b08 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -435,6 +435,7 @@ exiting. ARGS is the list of arguments received by the 'throw' handler." (gettext (condition-message obj) %gettext-domain))) ((formatted-message? obj) (warning (G_ "failed to load '~a': ~a~%") + file (apply format #f (gettext (formatted-message-string obj) %gettext-domain) -- cgit v1.2.3 From d75475762824a4fa7e743138da6a9d59d8690a33 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 8 Nov 2020 23:35:45 +0100 Subject: publish: Create files in the cache as #o644. Reported by Ricardo Wurmus . * guix/scripts/publish.scm (compress-nar): Add 'chmod' call to ensure PORT is #o644, in the uncompressed case. (bake-narinfo+nar): Likewise for the narinfo file. * tests/publish.scm ("with cache"): Check permissions on CACHED and NAR. --- guix/scripts/publish.scm | 12 ++++++++++-- tests/publish.scm | 5 +++++ 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'guix') diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm index e8faf379e2..e3c8711f5b 100644 --- a/guix/scripts/publish.scm +++ b/guix/scripts/publish.scm @@ -583,7 +583,10 @@ requested using POOL." ;; guarantee the TTL (see .) (with-atomic-file-output nar (lambda (port) - (write-file item port)))))) + (write-file item port) + ;; Make the file world-readable, contrary to what + ;; 'with-atomic-file-output' does. + (chmod port (logand #o644 (lognot (umask))))))))) (define* (bake-narinfo+nar cache item #:key ttl (compressions (list %no-compression)) @@ -615,7 +618,12 @@ requested using POOL." #:nar-path nar-path #:compressions compressions #:file-sizes sizes) - port))))) + port))) + + ;; Make the cached narinfo world-readable, contrary to what + ;; 'with-atomic-file-output' does, so that other users can rsync + ;; the whole cache. + (chmod port (logand #o644 (lognot (umask)))))) ;; Make narinfo files for OTHERS hard links to NARINFO such that the ;; atime-based cache eviction considers either all the nars or none diff --git a/tests/publish.scm b/tests/publish.scm index e46e6256b7..cafd0f13a2 100644 --- a/tests/publish.scm +++ b/tests/publish.scm @@ -434,6 +434,11 @@ References: ~%" (< ttl 3600))) (wait-for-file cached) + + ;; Both the narinfo and nar should be world-readable. + (= #o644 (stat:perms (lstat cached))) + (= #o644 (stat:perms (lstat nar))) + (let* ((body (http-get-port url)) (compressed (http-get nar-url)) (uncompressed (http-get (string-append base "nar/" -- cgit v1.2.3 From 362529963ea38dd0d9bcdd54d5fced5243427f3d Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 10 Nov 2020 14:40:20 +0100 Subject: ui: Use the right accessor when reporting '&gexp-input-error'. * guix/ui.scm (call-with-error-handling): In the 'gexp-input-error?' case, use 'gexp-error-invalid-input' as the accessor. --- guix/ui.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guix') diff --git a/guix/ui.scm b/guix/ui.scm index d5327a5b08..4e686297e8 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -718,7 +718,7 @@ evaluating the tests and bodies of CLAUSES." (package-full-name package) (build-system-name system)))) ((gexp-input-error? c) - (let ((input (package-error-invalid-input c))) + (let ((input (gexp-error-invalid-input c))) (leave (G_ "~s: invalid G-expression input~%") (gexp-error-invalid-input c)))) ((profile-not-found-error? c) -- cgit v1.2.3 From 1cbda46d4aae5ba9bd89a1837f0d81a29653ed7b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 10 Nov 2020 22:56:38 +0100 Subject: publish: Increase TCP buffer size when sending non-cached nars. This increases throughput tenfold (!) on localhost when downloading large nars without '--cache'. This is a followup to 5e3d169945935b53325e6b738a307ba286751259. Reported by Maxim Cournoyer. * guix/scripts/publish.scm (http-write): In the 'application/x-nix-archive' case, add call to 'setsockopt'. --- guix/scripts/publish.scm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'guix') diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm index e3c8711f5b..a976a9ac60 100644 --- a/guix/scripts/publish.scm +++ b/guix/scripts/publish.scm @@ -891,6 +891,8 @@ blocking." client)) (port (begin (force-output client) + (setsockopt client SOL_SOCKET + SO_SNDBUF (* 128 1024)) (nar-response-port response compression)))) ;; XXX: Given our ugly workaround for in ;; 'render-nar', BODY here is just the file name of the store item. -- cgit v1.2.3 From b73981369e414bfef6c4f8e48fc457a43c0e12cb Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 12 Nov 2020 09:29:05 +0100 Subject: lint: patch-file-names: Simplify 'search-patch' error handling. * guix/lint.scm (check-patch-file-names): Remove 'message-condition?' guard, which is useless since d51bfe242fbe6f3f8f71d723e8fe0c7bbe711ba1. Remove call to 'format' in the 'formatted-message?' case. --- guix/lint.scm | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'guix') diff --git a/guix/lint.scm b/guix/lint.scm index e1a77e8ac7..91dbc806dc 100644 --- a/guix/lint.scm +++ b/guix/lint.scm @@ -663,17 +663,11 @@ from ~a") (define (check-patch-file-names package) "Emit a warning if the patches requires by PACKAGE are badly named or if the patch could not be found." - (guard (c ((message-condition? c) ;raised by 'search-patch' - (list - ;; Use %make-warning, as condition-mesasge is already - ;; translated. - (%make-warning package (condition-message c) - #:field 'patch-file-names))) - ((formatted-message? c) + (guard (c ((formatted-message? c) ;raised by 'search-patch' (list (%make-warning package - (apply format #f - (G_ (formatted-message-string c)) - (formatted-message-arguments c)))))) + (formatted-message-string c) + (formatted-message-arguments c) + #:field 'source)))) (define patches (match (package-source package) ((? origin? origin) (origin-patches origin)) -- cgit v1.2.3