guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: cve: Disable position recording while reading the CVE list.


From: Ludovic Courtès
Subject: 02/02: cve: Disable position recording while reading the CVE list.
Date: Tue, 19 Sep 2017 17:58:31 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit f1b65d0dd964e4c457e660b9289a357447939d93
Author: Ludovic Courtès <address@hidden>
Date:   Tue Sep 19 21:24:31 2017 +0200

    cve: Disable position recording while reading the CVE list.
    
    * guix/cve.scm (fetch-vulnerabilities)[read*]: New procedure.
    Use it in lieu of 'read'.
---
 guix/cve.scm | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/guix/cve.scm b/guix/cve.scm
index 088e398..38e5994 100644
--- a/guix/cve.scm
+++ b/guix/cve.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2016 Ludovic Courtès <address@hidden>
+;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -229,11 +229,24 @@ the given TTL (fetch from the NIST web site when TTL has 
expired)."
            (now (current-time time-utc)))
       (< (+ (stat:mtime s) ttl) (time-second now))))
 
+  (define (read* port)
+    ;; Disable read options to avoid populating the source property weak
+    ;; table, which speeds things up, saves memory, and works around
+    ;; <https://lists.gnu.org/archive/html/guile-devel/2017-09/msg00031.html>.
+    (let ((options (read-options)))
+      (dynamic-wind
+        (lambda ()
+          (read-disable 'positions))
+        (lambda ()
+          (read port))
+        (lambda ()
+          (read-options options)))))
+
   (catch 'system-error
     (lambda ()
       (if (old? cache)
           (update-cache)
-          (match (call-with-input-file cache read)
+          (match (call-with-input-file cache read*)
             (('vulnerabilities 1 vulns)
              (map sexp->vulnerability vulns))
             (x



reply via email to

[Prev in Thread] Current Thread [Next in Thread]