GNU bug report logs - #55673
[PATCH] cache: Catch valid integer for 'last-expiry-cleanup'.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: zimoun <zimon.toutoune@HIDDEN>; Keywords: patch; dated Fri, 27 May 2022 08:26:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 55673 <at> debbugs.gnu.org:


Received: (at 55673) by debbugs.gnu.org; 27 May 2022 16:20:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 12:20:15 2022
Received: from localhost ([127.0.0.1]:35676 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nuchD-0007b0-F6
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 12:20:15 -0400
Received: from mail-pj1-f43.google.com ([209.85.216.43]:42987)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1nuchB-0007ag-L5
 for 55673 <at> debbugs.gnu.org; Fri, 27 May 2022 12:20:14 -0400
Received: by mail-pj1-f43.google.com with SMTP id
 cs3-20020a17090af50300b001e0808b5838so4783743pjb.1
 for <55673 <at> debbugs.gnu.org>; Fri, 27 May 2022 09:20:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=coB1NCuxcC85MbeMMPcUdyq7lT2/EV3iqJpW0372ZiE=;
 b=nprg6wrBYRG9V3h8i1fA/6NNgytFkgZgL0eATnj3ObeVTJj7XiX8TMV5ETkUO3INL9
 pA2xpgAj1q/2RhnYhbkVxMaNEneP9EmgjzW0960Qv6jximeWZdYvB98Z9qLe+Q6FJaZX
 FexYatOk9icNWje4jaRVedTVYS+KISUOcBNwMHW13yVD6CtdMcO4yDq/mhefljebiAJO
 QftBpZRyIuQEo9+8K2+oj9fjihGKUS8jDHyrx1tnozCatW3IMp9x1Uh+JbwEDN7wIPoS
 tmxepfNLL/nk6PycM4h5ukTp7dip/RDyUiF+iCESE2JZQrbjCj1/hnyr1pIM2rMi/pYl
 dDDQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=coB1NCuxcC85MbeMMPcUdyq7lT2/EV3iqJpW0372ZiE=;
 b=v7TIuCGeOq5lmi83P3RcwRmsY7hhN2ToiaZATra9jS6Bve6f/P6Fw9ctCy68PrmAPS
 1OoyaSVPqPXV+RsiwerZ+NGXo59/SsTj98qtQfjBUyC8YFesk1rcoIhb9pF8tzGPlPvw
 gTgCrU62FU8GaKVme8v/+44tUc7CJHIRpK7gepVFj7mCjLHo2MAVQ8ttFbjnIFx3twJU
 7vaUMIjqsTr4h9775VOTLPwAvS8ZGVpA+eFHv52+roSTacnEuQqlI00wbM6A2OxW8Ye2
 IfuXD/UbbZ9oPtuVKvJDtlH5YVNeBB3xpezukxU+fSBph+NYCj6kEd32OSTSekayPKTn
 l8NQ==
X-Gm-Message-State: AOAM533Pt3Q0WOTLzNqw6uw52dOJu59YAW3ZnDZNMLUc5eSLzeeXbFiI
 PWwVnN9StWGBFj3R0Y1t3qRxKWLl8Dca3QX3ACI=
X-Google-Smtp-Source: ABdhPJw/tjQrUU/Bd/if9tZF6w1UvhsYraZgf4fymymubh4bkOsDtyy36BXVI/G5XH1B/ny7poUNyXSjn6YNKVLOiEs=
X-Received: by 2002:a17:902:690b:b0:159:65c:9044 with SMTP id
 j11-20020a170902690b00b00159065c9044mr44715120plk.47.1653668407697; Fri, 27
 May 2022 09:20:07 -0700 (PDT)
MIME-Version: 1.0
References: <20220527082519.501697-1-zimon.toutoune@HIDDEN>
 <9432b1161007faacc0bd0e58da0bf839e2e8ec39.camel@HIDDEN>
 <CAJ3okZ2Rz3dvDC8qYs=DM2cP3ZQg1exHiRmYan-iDQ+0EtGctQ@HIDDEN>
 <24883447c6f3d9b27bcc6e11e117ee974916e091.camel@HIDDEN>
 <CAJ3okZ1TQTPiNMkei1vYy_GixUtUh+NVsbpjb=qJq-Z7UnDHQA@HIDDEN>
 <9483424cc3c89e5fa83ccc1e22b1f6cc7d04dd95.camel@HIDDEN>
 <CAJ3okZ2RLDNYS+XzBfaaDEf5_uMW+3dT7OUMfWLV4to_0gsFRQ@HIDDEN>
 <02f4e72bba800a2f59064a8bf628357b5a96f1d6.camel@HIDDEN>
 <CAJ3okZ2MWnKreFD_kxPnxaqkTa=LxNG_R1XcGs0EFi6Ly5SQSw@HIDDEN>
 <ab7445797a8f02495ed957861b22ca38459df45f.camel@HIDDEN>
In-Reply-To: <ab7445797a8f02495ed957861b22ca38459df45f.camel@HIDDEN>
From: zimoun <zimon.toutoune@HIDDEN>
Date: Fri, 27 May 2022 18:19:55 +0200
Message-ID: <CAJ3okZ2Z5P+xQHBzLSxASwWpfqEsxKmxe9S=cQP6JysvDWQc7g@HIDDEN>
Subject: Re: [bug#55673] [PATCH] cache: Catch valid integer for
 'last-expiry-cleanup'.
To: Maxime Devos <maximedevos@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55673
Cc: 55673 <at> debbugs.gnu.org, =?UTF-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

On Fri, 27 May 2022 at 16:02, Maxime Devos <maximedevos@HIDDEN> wrote:

> Also, I do not understand the resistance -- I have a simple proposal
> for generalising your patch to more failure modes, with a demonstration
> and test case (see the file "a") on when it is necessary and a
> proposed implementation.

I have sent a v2 using your proposal (which appears to me overcomplicated).

It is not resistance but pragmatic: the only case of interest is the
empty file, which happens -- all the others, I am still waiting at
least one bug report about them i.e., a user runs "guix time-machine"
and suddenly the file last-expiry-cleanup is corrupted and "guix
time-machine" unusable.  Pragmatic because, for instance, from 2 to "
or from 8 to ( it is one bit-flip and thus 'read' would be easily
broken.  I miss why such lengthy discussion about these theoretical
failures of last-expiry-cleanup when it is also true each time 'read'
is used, see least-authority or ui.scm etc. But I have never read a
word.  Anyway.


Cheers,
simon




Information forwarded to guix-patches@HIDDEN:
bug#55673; Package guix-patches. Full text available.

Message received at 55673 <at> debbugs.gnu.org:


Received: (at 55673) by debbugs.gnu.org; 27 May 2022 15:47:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 11:47:13 2022
Received: from localhost ([127.0.0.1]:35644 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nucBF-0006gv-KW
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 11:47:13 -0400
Received: from mail-wr1-f41.google.com ([209.85.221.41]:36800)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1nucBC-0006gh-OG
 for 55673 <at> debbugs.gnu.org; Fri, 27 May 2022 11:47:12 -0400
Received: by mail-wr1-f41.google.com with SMTP id u3so6381914wrg.3
 for <55673 <at> debbugs.gnu.org>; Fri, 27 May 2022 08:47:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=/9MTsnm05Ku6jeO1qnRc6AdRgafy7KjBcCVWHGD8mS8=;
 b=S6Pgm/yRA500QS4V0mjL/ZTUkIwxZJKi22mFJDSTKxhWM4xMDB5Wsk0ufN8G9QtQFS
 CoFz0fISG7dJr8ENWtE9XTd6srGAEL4/cf/lEtQJ++o3xHmOZbQGVEFCgEBfCqvKNpul
 yCNs25HopMhZoOxSJxH2948AoZVP6Kps+JtPKyWXqzWO/0K8gQJBjbyHFGzCzy5B9dyS
 TK78to62UHUq3RDsV2aiDawIapmnqkHt/k0HxQimnIN9s/DF0e6nUWEKuzYZTrIxS/Kn
 zZR8OtJoWf+mxxUUpVKtOKJtbjjRZM8O0aX3v3B2ZYDrdfFSoeYXsVfLgZaznbhnAV6S
 BfDQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=/9MTsnm05Ku6jeO1qnRc6AdRgafy7KjBcCVWHGD8mS8=;
 b=WNwKFlEFB1iQHckdtEgqAOCy1sJCn5WoWrB9rmjGPIooOA+cRat64IDWqpDWHI+tY8
 W2K8rc1yho23N2w4Wiyi4clOFzkG3nTK4aTmxJcfKiKv/W3efobWJu2Ssq+Tlo9M1jB/
 s5AKJj4wJCf6Dk3SRSNd4s9msVxlZTnD8sYmrUZtuP1jsusqij1ASFdVjG9NrybYmNpY
 Y3xitQPYo2VMnecUqufQUN4uiIsS9R2VTyEY+VKKQe7/8nL3Jj/W5+wnAd7kFnCcGCIx
 nLfrE7jEIfL+Nqtwewms2Y8iiNbkDVHmaTJ8xu0YiEXrkGVH/xIAf9XZbDgHqBBoacbK
 /pzQ==
X-Gm-Message-State: AOAM533AyghmwRMsWOV2A3utdu6JM0v9PIdFE1tRrZvNQDsO/QI18zbf
 FGWLOp2Tgju0bdGP1yU8LsThdb6fIYg=
X-Google-Smtp-Source: ABdhPJwI4fZflGnsTR+3rTM7oJQsyulxXWsDu/mf1k50/ZaTmseG/zf/VNiLcAP3NC79ULXC5a7NaA==
X-Received: by 2002:a5d:588d:0:b0:20f:f290:ed83 with SMTP id
 n13-20020a5d588d000000b0020ff290ed83mr14866356wrf.588.1653666424488; 
 Fri, 27 May 2022 08:47:04 -0700 (PDT)
Received: from localhost.localdomain ([193.48.40.241])
 by smtp.gmail.com with ESMTPSA id
 y4-20020a056000168400b0020fd392df33sm2069044wrd.29.2022.05.27.08.47.03
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 27 May 2022 08:47:04 -0700 (PDT)
From: zimoun <zimon.toutoune@HIDDEN>
To: 55673 <at> debbugs.gnu.org
Subject: [PATCH v2] cache: Catch valid integer for 'last-expiry-cleanup'.
Date: Fri, 27 May 2022 17:46:52 +0200
Message-Id: <20220527154652.700549-1-zimon.toutoune@HIDDEN>
X-Mailer: git-send-email 2.36.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55673
Cc: zimoun <zimon.toutoune@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Fixes <http://issues.guix.gnu.org/55638>.

* guix/cache.scm (maybe-remove-expired-cache-entries)[last-expiry-date]: Check
if the date is a valid integer.
* tests/cache.scm: Test it.
---
 guix/cache.scm  | 16 ++++++++++++----
 tests/cache.scm | 22 ++++++++++++++++++++++
 2 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/guix/cache.scm b/guix/cache.scm
index 51009809bd..13f9e4a439 100644
--- a/guix/cache.scm
+++ b/guix/cache.scm
@@ -20,6 +20,7 @@ (define-module (guix cache)
   #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 match)
+  #:use-module ((ice-9 textual-ports) #:select (get-string-all))
   #:export (obsolete?
             delete-file*
             file-expiration-time
@@ -91,10 +92,17 @@ (define expiry-file
     (string-append cache "/last-expiry-cleanup"))
 
   (define last-expiry-date
-    (catch 'system-error
-      (lambda ()
-        (call-with-input-file expiry-file read))
-      (const 0)))
+    (let ((value (catch 'system-error
+                   (lambda ()
+                     (call-with-input-file expiry-file get-string-all))
+                   (const "0"))))
+      (catch #t   ; Handle value out of range (e.g., 1234567890 -> 12E4567890)
+        (lambda ()
+          ;; Handle empty or corrupted 'expiry-file' when 'write' below is
+          ;; interrupted before being complete (e.g., SIGINT with C-c) or when
+          ;; the filesystem crashes.
+          (or (string->number value) 0))
+        (const 0))))
 
   (when (obsolete? last-expiry-date now cleanup-period)
     (remove-expired-cache-entries (cache-entries cache)
diff --git a/tests/cache.scm b/tests/cache.scm
index 80b44d69aa..bd6fd64a22 100644
--- a/tests/cache.scm
+++ b/tests/cache.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017, 2020 Ludovic Courtès <ludo@HIDDEN>
+;;; Copyright © 2022 Simon Tournier <zimon.toutoune@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -74,6 +75,27 @@ (define-syntax-rule (test-cache-cleanup cache exp ...)
       (lambda (port)
         (display 0 port)))))
 
+(test-equal "maybe-remove-expired-cache-entries, empty cache"
+  '("a" "b" "c")
+  (test-cache-cleanup cache
+    (call-with-output-file (string-append cache "/last-expiry-cleanup")
+      (lambda (port)
+        (display "" port)))))
+
+(test-equal "maybe-remove-expired-cache-entries, corrupted cache"
+  '("a" "b" "c")
+  (test-cache-cleanup cache
+    (call-with-output-file (string-append cache "/last-expiry-cleanup")
+      (lambda (port)
+        (display "1\"34657890" port)))))
+
+(test-equal "maybe-remove-expired-cache-entries, corrupted cache of out range"
+  '("a" "b" "c")
+  (test-cache-cleanup cache
+    (call-with-output-file (string-append cache "/last-expiry-cleanup")
+      (lambda (port)
+        (display "12E4567890" port)))))
+
 (test-end "cache")
 
 ;;; Local Variables:

base-commit: 38bf6c7d0cb588e8d4546db7d2e0bae2ec25183d
-- 
2.36.0





Information forwarded to guix-patches@HIDDEN:
bug#55673; Package guix-patches. Full text available.

Message received at 55673 <at> debbugs.gnu.org:


Received: (at 55673) by debbugs.gnu.org; 27 May 2022 14:02:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 10:02:46 2022
Received: from localhost ([127.0.0.1]:35531 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nuaY9-0003zt-OS
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 10:02:45 -0400
Received: from michel.telenet-ops.be ([195.130.137.88]:55300)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1nuaY7-0003zh-76
 for 55673 <at> debbugs.gnu.org; Fri, 27 May 2022 10:02:44 -0400
Received: from [172.20.10.5] ([188.188.246.167])
 by michel.telenet-ops.be with bizsmtp
 id bq2g270023dS87Q06q2geG; Fri, 27 May 2022 16:02:41 +0200
Message-ID: <ab7445797a8f02495ed957861b22ca38459df45f.camel@HIDDEN>
Subject: Re: [bug#55673] [PATCH] cache: Catch valid integer for
 'last-expiry-cleanup'.
From: Maxime Devos <maximedevos@HIDDEN>
To: zimoun <zimon.toutoune@HIDDEN>
Date: Fri, 27 May 2022 16:02:29 +0200
In-Reply-To: <CAJ3okZ2MWnKreFD_kxPnxaqkTa=LxNG_R1XcGs0EFi6Ly5SQSw@HIDDEN>
References: <20220527082519.501697-1-zimon.toutoune@HIDDEN>
 <9432b1161007faacc0bd0e58da0bf839e2e8ec39.camel@HIDDEN>
 <CAJ3okZ2Rz3dvDC8qYs=DM2cP3ZQg1exHiRmYan-iDQ+0EtGctQ@HIDDEN>
 <24883447c6f3d9b27bcc6e11e117ee974916e091.camel@HIDDEN>
 <CAJ3okZ1TQTPiNMkei1vYy_GixUtUh+NVsbpjb=qJq-Z7UnDHQA@HIDDEN>
 <9483424cc3c89e5fa83ccc1e22b1f6cc7d04dd95.camel@HIDDEN>
 <CAJ3okZ2RLDNYS+XzBfaaDEf5_uMW+3dT7OUMfWLV4to_0gsFRQ@HIDDEN>
 <02f4e72bba800a2f59064a8bf628357b5a96f1d6.camel@HIDDEN>
 <CAJ3okZ2MWnKreFD_kxPnxaqkTa=LxNG_R1XcGs0EFi6Ly5SQSw@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-fxBjGupYufBB3okcZz5B"
User-Agent: Evolution 3.38.3-1 
MIME-Version: 1.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22;
 t=1653660161; bh=9SXbu5+8idzcy6lvQoNSWInju/hjfU/2QmsdE/YYRVQ=;
 h=Subject:From:To:Cc:Date:In-Reply-To:References;
 b=EZYHkq3z1Lt/SYu/kocZnJpxfPTph+jteRtYTeX1DN91jVPFnQGrMfj9QNBSo59ih
 +knw5S8XVeZQ4lC4I7kB03oN7utd0Vp1oQJ8jRkeKaNHOcJxKtsIouVUD9hEn9akjO
 mbZR3edBk/w9z/Ys/So6gr1OXVpxUaRWaAS4nYz3N1aEHF/L/G76dDuu2RmVOHmPba
 MZ/ctGjfVgUrNXNNT32ToMLV+oT+gYQVpk4stUjG1+rB6pAKh19A1BfdvqhsKTIRge
 Kr3QOcpl/SWMta/hhrBHOkvXJC1ZdpiQjxIaE6KXQFw++x7RW+fvmtIfXFuvmUOZAT
 dk0MLdGRMY6aw==
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55673
Cc: 55673 <at> debbugs.gnu.org, Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--=-fxBjGupYufBB3okcZz5B
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

> > The difference is that ^R is interpreted as a symbol, whereas "foo
> > cannot be interpreted as anything at all by 'read'.
> I do not understand what you mean

^R is interpreted as a symbol:
 (symbol? (call-with-input-string "\x12" read)).
"foo" is interpreted as a string:
 (string? (call-with-input-string "\"foo\"" read))
"foo without a terminating string cannot be interpreted at all:
 (call-with-input-string "\"foo" read)

> and I think you are overengineering.

It's not any more overengineering than catching not-an-integer IMO.

AFAICT, this does not find the definition of overengineering I found
on Wikipedia.

Also, I do not understand the resistance -- I have a simple proposal
for generalising your patch to more failure modes, with a demonstration
and test case (see the file "a") on when it is necessary and a
proposed implementation.

zimoun schreef op vr 27-05-2022 om 15:23 [+0200]:
If you are able to produce a corrupted file which breaks "guix
time-machine", then we can examine.=C2=A0 Else let move on. :-)

I previously produced the corrupted file, see the file "a".

I am not willing to deliberately corrupt my file system for this,
especially when I can just give a synthetic example of corrupted
file (see the file "a") and especially since making a synthetic
example is much simpler and faster.

Greetings,
Maxime.

--=-fxBjGupYufBB3okcZz5B
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYpDZ9RccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7icOAPwPHcd5Z6PsdU6lw8lk7HcX1iFG
kLtK37QV5tnJSMZYHwD+ObFnnfbUhNH1mxjxADTLaVFS/XZ6DoxyQHuB39vX6QI=
=RLZx
-----END PGP SIGNATURE-----

--=-fxBjGupYufBB3okcZz5B--





Information forwarded to guix-patches@HIDDEN:
bug#55673; Package guix-patches. Full text available.

Message received at 55673 <at> debbugs.gnu.org:


Received: (at 55673) by debbugs.gnu.org; 27 May 2022 13:31:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 09:31:05 2022
Received: from localhost ([127.0.0.1]:33160 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nua3U-0002YM-MC
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 09:31:04 -0400
Received: from mail-pj1-f41.google.com ([209.85.216.41]:43900)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1nua3S-0002Y1-NX
 for 55673 <at> debbugs.gnu.org; Fri, 27 May 2022 09:31:03 -0400
Received: by mail-pj1-f41.google.com with SMTP id
 l7-20020a17090aaa8700b001dd1a5b9965so4386308pjq.2
 for <55673 <at> debbugs.gnu.org>; Fri, 27 May 2022 06:31:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=HWxPTqky52mPxblg62MNxf4HOtkb5Q5VbYAixZXtQt0=;
 b=e+NLIwGuVUYcqXRbhg2dCYWDL4G6tzX+vhiQQjXgcbVL9/t+inKl2YeMMUqIsnfeFP
 S/yQBUgX8Ro/eiwQZI1neLWETXnPv5NABTkCcMqvxf7MjjE/cdARHr/rlWh4jlzDiUvM
 QqBybxjBmOXteSFVs0DID0PvdwBry4mWVaO3R5MQDOTEQv6yXba6Cs6kBBwZxTGWcP4Z
 Ezdnq2znS4OUDsngTkyzHzxMB45vNWHUHPZnsbpc3jNBMjJj6VwzloyCYBDaH8veJ7z4
 LZzTCricuuHCa/Wy0onDjX+9lcue1V1Hs/Ynp56YUxhoPtEcLuqlVtQ9yok6nqntURWS
 i8yw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=HWxPTqky52mPxblg62MNxf4HOtkb5Q5VbYAixZXtQt0=;
 b=eJ5dNJZVZt1r/HvhkdSu4gW20dSM/Oc5q9z/zGfhBJvUgQMRJsKY0UezC2bhxQzzNX
 Sgl7sVFutyH3cPN7qRSalgh6yzGgV1J6KlojRboECtlrN83ILvuvhNbKlPSDJr46Bvfz
 UTj+3bT0S7tGuXWMWfWGbE7MjKh6FE1u7dsDTK42RDqp5zK8toEoHKeyu4W8REkFsx/x
 CuWo7W4gKmV3XK5lU5YS6As/wBXCSerUMgDMx2vvYh0TVun6Pe+APCxGgtropChgGpsc
 tXQqgqpNxUyrhkpENNFRklp1/AY6ww1RPDSu+zxgTX6rsHjx4/yU8k0d4roqFJTfJzYy
 ZxAA==
X-Gm-Message-State: AOAM531Cx5uyvg/Ec0xzmpipqw9Xg4HG5PmAHdrO/UWh7Pri85yVMYR7
 +0v85Zhn2BKlZrMP4tSCZfx3HmefjV4ZE2VlDnc=
X-Google-Smtp-Source: ABdhPJx6NN81SKhK8vH76Na8AhlaBe9d8XivWWwYloq/meMu23XltOl9d90I5Ks57HGFyI7vkGegwFd2rhakbFQPgVY=
X-Received: by 2002:a17:902:da8c:b0:162:33b5:6aa1 with SMTP id
 j12-20020a170902da8c00b0016233b56aa1mr21818361plx.75.1653658256777; Fri, 27
 May 2022 06:30:56 -0700 (PDT)
MIME-Version: 1.0
References: <20220527082519.501697-1-zimon.toutoune@HIDDEN>
 <9432b1161007faacc0bd0e58da0bf839e2e8ec39.camel@HIDDEN>
 <CAJ3okZ2Rz3dvDC8qYs=DM2cP3ZQg1exHiRmYan-iDQ+0EtGctQ@HIDDEN>
 <24883447c6f3d9b27bcc6e11e117ee974916e091.camel@HIDDEN>
 <CAJ3okZ1TQTPiNMkei1vYy_GixUtUh+NVsbpjb=qJq-Z7UnDHQA@HIDDEN>
 <9483424cc3c89e5fa83ccc1e22b1f6cc7d04dd95.camel@HIDDEN>
 <CAJ3okZ2RLDNYS+XzBfaaDEf5_uMW+3dT7OUMfWLV4to_0gsFRQ@HIDDEN>
 <02f4e72bba800a2f59064a8bf628357b5a96f1d6.camel@HIDDEN>
 <CAJ3okZ2MWnKreFD_kxPnxaqkTa=LxNG_R1XcGs0EFi6Ly5SQSw@HIDDEN>
In-Reply-To: <CAJ3okZ2MWnKreFD_kxPnxaqkTa=LxNG_R1XcGs0EFi6Ly5SQSw@HIDDEN>
From: zimoun <zimon.toutoune@HIDDEN>
Date: Fri, 27 May 2022 15:30:45 +0200
Message-ID: <CAJ3okZ3YmbYC+XPtY16B_fvh30iWkbh0Quya1Dq0LiwN0=Swqw@HIDDEN>
Subject: Re: [bug#55673] [PATCH] cache: Catch valid integer for
 'last-expiry-cleanup'.
To: Maxime Devos <maximedevos@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55673
Cc: 55673 <at> debbugs.gnu.org, =?UTF-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Fri, 27 May 2022 at 15:23, zimoun <zimon.toutoune@HIDDEN> wrote:
> On Fri, 27 May 2022 at 15:04, Maxime Devos <maximedevos@HIDDEN> wrote:
>
> > scheme@(guile-user)> (call-with-input-file "a" read)
> > ice-9/boot-9.scm:1669:16: In procedure raise-exception:
> > In procedure scm_lreadr: a:2:1: end of file in string constant
>
> This is an ad-hoc example and not a real test case.

[...]

> I am not able to imagine an incomplete file worse than \\x00.

Just to be sure, I mean: an incomplete integer.

For sure, any incomplete (unbalanced) sexp is breaking 'read', as the
example "foo or (1 or whatever else; as you are correctly pointing.
But since the cache 'write' an integer, it means it would be an
incomplete integer.


Cheers,
simon




Information forwarded to guix-patches@HIDDEN:
bug#55673; Package guix-patches. Full text available.

Message received at 55673 <at> debbugs.gnu.org:


Received: (at 55673) by debbugs.gnu.org; 27 May 2022 13:23:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 09:23:50 2022
Received: from localhost ([127.0.0.1]:33154 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nuZwT-0002NP-VY
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 09:23:50 -0400
Received: from mail-pl1-f178.google.com ([209.85.214.178]:38755)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1nuZwS-0002NB-QO
 for 55673 <at> debbugs.gnu.org; Fri, 27 May 2022 09:23:49 -0400
Received: by mail-pl1-f178.google.com with SMTP id n18so4137315plg.5
 for <55673 <at> debbugs.gnu.org>; Fri, 27 May 2022 06:23:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=vrHJ9SqbUMfXQLAh8Ir1Ac0VshvCxHRiToe++y31GD8=;
 b=PoIWBfYI8IuMkYaATorW3kim24aLLqy9f4f0b6wRO6YGrgnRlqE3RM90lHkRoG4S2L
 pIeuskx19Wfg+0MWlV0cOMH4MkERWhm/py/jfvnN2K3p3MY/OxTZ+MQO6oAZK3H/zRX+
 7tTrmSvCJnKsOOHhmojqIfjcTtRhgRspb6iirOLgxYOwf4uc98gQeQv+z0msU5CWcxHN
 Tnj5Ez+8/uUblYIGLwyKONQBy/R45fkHGMF+3WhfDy+jU/80SqF4vqmBWA6P+eqyJ0Pj
 xWKDvy7TGKTYqkM9iYjrwBZhXAXVihgqZDtjiZv5XgLtMcAZeK4IPwM9rumRUFu6YQYo
 GIEw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=vrHJ9SqbUMfXQLAh8Ir1Ac0VshvCxHRiToe++y31GD8=;
 b=v/gYFMuMhO6LJU65VveEGokO7+Iqm0E8VpbZn0NCJDuiMWbtBEIVVapCgfiphnZa3/
 m4UWypSAlHjTN4zjYaOKFjL1ewwbDRPI1tEd50d149zeZXZb+wN8IQF9QTMvjqv0pA31
 cg+UoO8ZPpMFEBLLKGIWDgHHwF3KsxxC12vFfYOMhy5sPWRZYigmX8093gEZTLVhS6ls
 f8O392jS8BYPlKzCdleb2cenej43PpN43VP4puH9FEKGXQ1WNuVxE+k04k9hhKork8Qy
 KyoFo2ZykEcdE1RTiz3mtel02RDfrOfkTfz4FmqCvGe+1nCdsaoAh+NE2IJgcCIgH8+W
 ThDQ==
X-Gm-Message-State: AOAM530WjDCGYimGne2oS4NsgJD9VCXPJspFoR2sKcPeKB8WrppHtPZb
 +75uarQ+b0um8J0rjvHIEUwOYFREcym8jnLK5nQ=
X-Google-Smtp-Source: ABdhPJzJ9/F1bcHKK/4y2lQ638UhiyH1FUCuE17I0yjcm2JuVRXSTT6w78wUCHO/vr9M0Yl7c2MfMTDjlglGaHcoBqc=
X-Received: by 2002:a17:902:690b:b0:159:65c:9044 with SMTP id
 j11-20020a170902690b00b00159065c9044mr43986489plk.47.1653657823097; Fri, 27
 May 2022 06:23:43 -0700 (PDT)
MIME-Version: 1.0
References: <20220527082519.501697-1-zimon.toutoune@HIDDEN>
 <9432b1161007faacc0bd0e58da0bf839e2e8ec39.camel@HIDDEN>
 <CAJ3okZ2Rz3dvDC8qYs=DM2cP3ZQg1exHiRmYan-iDQ+0EtGctQ@HIDDEN>
 <24883447c6f3d9b27bcc6e11e117ee974916e091.camel@HIDDEN>
 <CAJ3okZ1TQTPiNMkei1vYy_GixUtUh+NVsbpjb=qJq-Z7UnDHQA@HIDDEN>
 <9483424cc3c89e5fa83ccc1e22b1f6cc7d04dd95.camel@HIDDEN>
 <CAJ3okZ2RLDNYS+XzBfaaDEf5_uMW+3dT7OUMfWLV4to_0gsFRQ@HIDDEN>
 <02f4e72bba800a2f59064a8bf628357b5a96f1d6.camel@HIDDEN>
In-Reply-To: <02f4e72bba800a2f59064a8bf628357b5a96f1d6.camel@HIDDEN>
From: zimoun <zimon.toutoune@HIDDEN>
Date: Fri, 27 May 2022 15:23:31 +0200
Message-ID: <CAJ3okZ2MWnKreFD_kxPnxaqkTa=LxNG_R1XcGs0EFi6Ly5SQSw@HIDDEN>
Subject: Re: [bug#55673] [PATCH] cache: Catch valid integer for
 'last-expiry-cleanup'.
To: Maxime Devos <maximedevos@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55673
Cc: 55673 <at> debbugs.gnu.org, =?UTF-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Maxime,

On Fri, 27 May 2022 at 15:04, Maxime Devos <maximedevos@HIDDEN> wrote:

> scheme@(guile-user)> (call-with-input-file "a" read)
> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
> In procedure scm_lreadr: a:2:1: end of file in string constant

This is an ad-hoc example and not a real test case.

--8<---------------cut here---------------start------------->8---
$ echo "foo" > ~/.cache/guix/inferiors/last-expiry-cleanup
$ cat ~/.cache/guix/inferiors/last-expiry-cleanup
foo
$ ./pre-inst-env guix time-machine --commit=9d795fb -- help
Usage: guix OPTION | COMMAND ARGS...
Run COMMAND with ARGS, if given.
--8<---------------cut here---------------end--------------->8---

As previously mentioned, the patch fixes:

 - empty file
 - non-integer

I am not able to imagine an incomplete file worse than \\x00.


> The difference is that ^R is interpreted as a symbol, whereas "foo
> cannot be interpreted as anything at all by 'read'.

I do not understand what you mean and I think you are overengineering.

If you are able to produce a corrupted file which breaks "guix
time-machine", then we can examine.  Else let move on. :-)


Cheers,
simon




Information forwarded to guix-patches@HIDDEN:
bug#55673; Package guix-patches. Full text available.

Message received at 55673 <at> debbugs.gnu.org:


Received: (at 55673) by debbugs.gnu.org; 27 May 2022 13:04:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 09:04:59 2022
Received: from localhost ([127.0.0.1]:33102 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nuZeE-0001t4-WB
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 09:04:59 -0400
Received: from albert.telenet-ops.be ([195.130.137.90]:43804)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1nuZeA-0001ss-GE
 for 55673 <at> debbugs.gnu.org; Fri, 27 May 2022 09:04:58 -0400
Received: from [172.20.10.5] ([188.188.246.167])
 by albert.telenet-ops.be with bizsmtp
 id bp4s270013dS87Q06p4sVk; Fri, 27 May 2022 15:04:53 +0200
Message-ID: <02f4e72bba800a2f59064a8bf628357b5a96f1d6.camel@HIDDEN>
Subject: Re: [bug#55673] [PATCH] cache: Catch valid integer for
 'last-expiry-cleanup'.
From: Maxime Devos <maximedevos@HIDDEN>
To: zimoun <zimon.toutoune@HIDDEN>
Date: Fri, 27 May 2022 15:04:47 +0200
In-Reply-To: <CAJ3okZ2RLDNYS+XzBfaaDEf5_uMW+3dT7OUMfWLV4to_0gsFRQ@HIDDEN>
References: <20220527082519.501697-1-zimon.toutoune@HIDDEN>
 <9432b1161007faacc0bd0e58da0bf839e2e8ec39.camel@HIDDEN>
 <CAJ3okZ2Rz3dvDC8qYs=DM2cP3ZQg1exHiRmYan-iDQ+0EtGctQ@HIDDEN>
 <24883447c6f3d9b27bcc6e11e117ee974916e091.camel@HIDDEN>
 <CAJ3okZ1TQTPiNMkei1vYy_GixUtUh+NVsbpjb=qJq-Z7UnDHQA@HIDDEN>
 <9483424cc3c89e5fa83ccc1e22b1f6cc7d04dd95.camel@HIDDEN>
 <CAJ3okZ2RLDNYS+XzBfaaDEf5_uMW+3dT7OUMfWLV4to_0gsFRQ@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-lt5QqNA0CMplr2EWDoC4"
User-Agent: Evolution 3.38.3-1 
MIME-Version: 1.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22;
 t=1653656693; bh=7n2dYR0qKlCCgCHeyLhs4Tnr4Z0UqkNTU7zeJVVVPqY=;
 h=Subject:From:To:Cc:Date:In-Reply-To:References;
 b=GG8oAKM3SqQ++VqJjpB1kUWa8Ydopj+ACbkYkdoxRnIw13MDbfAbf883/Vy3qyvKy
 aPTPpwnRaQ3qD84BkEOvj7Q0HIO3YFwf/fkd89Jv9OGmoiKquEjxCQz/j4uE8yvsWD
 2aHPqSjTax1MDTw9yWwZAJ9JQwCfaaWcDse3fLfkE6ztKzTvdoxzLVTF8hs3hnhcwH
 521ZLblHbtLxVbwnJRcTLGzQsShVCXqtCZ4aLAMHMZZ4KmhhU3FkAFzXPta5OAf5dO
 Ua35HhnZXaFCDTtv0TW5Q/sR9BX/kL48VgIc41uKbeetIp6yQf+h3aCaC+lhm8f0nR
 ub/BiPGz77GLg==
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55673
Cc: 55673 <at> debbugs.gnu.org, Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--=-lt5QqNA0CMplr2EWDoC4
Content-Type: multipart/mixed; boundary="=-SfM7dMVCjZs/3NNglwL8"


--=-SfM7dMVCjZs/3NNglwL8
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

zimoun schreef op vr 27-05-2022 om 14:40 [+0200]:
> > These old 4 bytes could be the ASCII representation of
> >=20
> > =C2=A0=C2=A0 "foo
> >=20
> > .=C2=A0 Then, when 'read' is run (after rebooting), it sees an
> > incomplete
> > string "foo, so it fails.
>=20
> The question is how would 'read' fail or what would 'read' return?
> For instance, the patch works for these cases:
>=20
> =C2=A0- empty file
> =C2=A0- non-integer
>=20
> Now, if you are able to generate an incomplete file (from an integer
> or whatever) against the patch fails, then we can examine.=C2=A0 However,
> I
> miss what would be the difference between this incomplete file and,
> let say, this case:
>=20
> =C2=A0=C2=A0=C2=A0=C2=A0 echo -n -e \\x12 > ~/.cache/guix/inferiors/last-=
expiry-cleanup
>=20
> handled by the patch.

The incomplete file is:

   "foo

as mentioned previously.  Here's how it fails:

scheme@(guile-user)> (call-with-input-file "a" read)
ice-9/boot-9.scm:1669:16: In procedure raise-exception:
In procedure scm_lreadr: a:2:1: end of file in string constant

The difference is that ^R is interpreted as a symbol, whereas "foo
cannot be interpreted as anything at all by 'read'.

Greetings,
Maxime.

--=-SfM7dMVCjZs/3NNglwL8
Content-Disposition: attachment; filename="a"
Content-Type: text/plain; name="a"; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

"foo
--=-SfM7dMVCjZs/3NNglwL8--

--=-lt5QqNA0CMplr2EWDoC4
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYpDMbxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7uY/AP0YSCfNMQK5NfD6dmr2mNvFQ/1D
TSSH+3utwWSQeKo6FQEA1QbRLfGgqk2X3jSsMyhG3FnjPVROqsl3RDX94wpzcAU=
=rsM8
-----END PGP SIGNATURE-----

--=-lt5QqNA0CMplr2EWDoC4--





Information forwarded to guix-patches@HIDDEN:
bug#55673; Package guix-patches. Full text available.

Message received at 55673 <at> debbugs.gnu.org:


Received: (at 55673) by debbugs.gnu.org; 27 May 2022 12:40:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 08:40:46 2022
Received: from localhost ([127.0.0.1]:33065 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nuZGn-0001EL-QB
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 08:40:45 -0400
Received: from mail-pg1-f169.google.com ([209.85.215.169]:43840)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1nuZGm-0001E9-Mu
 for 55673 <at> debbugs.gnu.org; Fri, 27 May 2022 08:40:45 -0400
Received: by mail-pg1-f169.google.com with SMTP id s68so3823565pgs.10
 for <55673 <at> debbugs.gnu.org>; Fri, 27 May 2022 05:40:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=uwNk8mKy2kwCrfpBvpBZOg4ZyhZVP5A4Af0mTnmX734=;
 b=i6WXXURUkjgcZuAkJokqb33EtDvIbl3cDPjEpzUxlm9jqRncJGnAV2xCiXrK++Hvcx
 DCTqLuP8NxC4PHElV0SRqbhswzThO7B0+Tj5VRerI5s/s9c88rf/xx7rLXn+ERbmki0i
 uEo4H9rvNPW+poC9zTWBJ6H0ATa7lm5ETYjulZ1mfftpbuoognmGZ5VwhYUHXCgflj2L
 ItY/EEMPW/DZhgvb47AkJr+6e6cNculSUk5TbqkJrfmvc+vUj8/0ElGIbn0sV3Aw3iqs
 39PR1NkYKS24vBpsMr27AlADjb9FNbi2GhXFZ8kWrl1xna50J1AweHZkKe/J6MrmVHSi
 qq0Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=uwNk8mKy2kwCrfpBvpBZOg4ZyhZVP5A4Af0mTnmX734=;
 b=ajKxtTVd/xowRs2kLDn1NgRLTihVQ0f1/MeBKlSE3YOcBQJwgoZ7o0Jpg5SiDQWxq9
 jh/wGdRLGlFzu0FhRylrzIm4DcHz66DzVIodthdZZNNbWbN7qgHdhLl3vEFfmurlIODZ
 fidmBaeej6K7+5C+mxVioSglIbbG0+f0dEn84H/5O1kRwmFi7NqsASubZ3edbU1ilcrY
 dBX/ENQN1s2FpbAlbbyEGj2Jwm9oBA7PUO2u825GqztkTEo8g3I1Huvc43tTc9+3Zrn3
 /BFuZLabSJ1VNR1jp4YrAdMUiCpdhfijMd9UWb9oKTEtPBOWW4IbYyAoorl9t1uNhMqy
 mZLg==
X-Gm-Message-State: AOAM533RwF7mRQSXSu0gmwx1PqmlYXUWxRoBsCgE/OttMsHNuEt9dgJe
 OmFaNjHmDkWK21VV/WCTF/K6qh7br8oXpgL/qG0=
X-Google-Smtp-Source: ABdhPJxjmBIBG3iL9x2qMhUSp9QXe8HukxCrXVAvUToGtJyW2HkD8+yVyKQ4gywFTfINGN1/03n0tOvpoFmr98sYUCU=
X-Received: by 2002:a63:144c:0:b0:3fa:6f09:a3e4 with SMTP id
 12-20020a63144c000000b003fa6f09a3e4mr19871396pgu.102.1653655238891; Fri, 27
 May 2022 05:40:38 -0700 (PDT)
MIME-Version: 1.0
References: <20220527082519.501697-1-zimon.toutoune@HIDDEN>
 <9432b1161007faacc0bd0e58da0bf839e2e8ec39.camel@HIDDEN>
 <CAJ3okZ2Rz3dvDC8qYs=DM2cP3ZQg1exHiRmYan-iDQ+0EtGctQ@HIDDEN>
 <24883447c6f3d9b27bcc6e11e117ee974916e091.camel@HIDDEN>
 <CAJ3okZ1TQTPiNMkei1vYy_GixUtUh+NVsbpjb=qJq-Z7UnDHQA@HIDDEN>
 <9483424cc3c89e5fa83ccc1e22b1f6cc7d04dd95.camel@HIDDEN>
In-Reply-To: <9483424cc3c89e5fa83ccc1e22b1f6cc7d04dd95.camel@HIDDEN>
From: zimoun <zimon.toutoune@HIDDEN>
Date: Fri, 27 May 2022 14:40:27 +0200
Message-ID: <CAJ3okZ2RLDNYS+XzBfaaDEf5_uMW+3dT7OUMfWLV4to_0gsFRQ@HIDDEN>
Subject: Re: [bug#55673] [PATCH] cache: Catch valid integer for
 'last-expiry-cleanup'.
To: Maxime Devos <maximedevos@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55673
Cc: 55673 <at> debbugs.gnu.org, =?UTF-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Maxime,

On Fri, 27 May 2022 at 13:49, Maxime Devos <maximedevos@HIDDEN> wrote:

> These old 4 bytes could be the ASCII representation of
>
>   "foo
>
> .  Then, when 'read' is run (after rebooting), it sees an incomplete
> string "foo, so it fails.

The question is how would 'read' fail or what would 'read' return?
For instance, the patch works for these cases:

 - empty file
 - non-integer

Now, if you are able to generate an incomplete file (from an integer
or whatever) against the patch fails, then we can examine.  However, I
miss what would be the difference between this incomplete file and,
let say, this case:

     echo -n -e \\x12 > ~/.cache/guix/inferiors/last-expiry-cleanup

handled by the patch.


Cheers,
simon




Information forwarded to guix-patches@HIDDEN:
bug#55673; Package guix-patches. Full text available.

Message received at 55673 <at> debbugs.gnu.org:


Received: (at 55673) by debbugs.gnu.org; 27 May 2022 11:49:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 07:49:19 2022
Received: from localhost ([127.0.0.1]:32973 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nuYT1-0006Bw-9r
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 07:49:19 -0400
Received: from baptiste.telenet-ops.be ([195.130.132.51]:47218)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1nuYSy-0006Bk-E8
 for 55673 <at> debbugs.gnu.org; Fri, 27 May 2022 07:49:18 -0400
Received: from [172.20.10.5] ([188.188.253.34])
 by baptiste.telenet-ops.be with bizsmtp
 id bnpE270010lHqdo01npEF7; Fri, 27 May 2022 13:49:14 +0200
Message-ID: <9483424cc3c89e5fa83ccc1e22b1f6cc7d04dd95.camel@HIDDEN>
Subject: Re: [bug#55673] [PATCH] cache: Catch valid integer for
 'last-expiry-cleanup'.
From: Maxime Devos <maximedevos@HIDDEN>
To: zimoun <zimon.toutoune@HIDDEN>
Date: Fri, 27 May 2022 13:49:08 +0200
In-Reply-To: <CAJ3okZ1TQTPiNMkei1vYy_GixUtUh+NVsbpjb=qJq-Z7UnDHQA@HIDDEN>
References: <20220527082519.501697-1-zimon.toutoune@HIDDEN>
 <9432b1161007faacc0bd0e58da0bf839e2e8ec39.camel@HIDDEN>
 <CAJ3okZ2Rz3dvDC8qYs=DM2cP3ZQg1exHiRmYan-iDQ+0EtGctQ@HIDDEN>
 <24883447c6f3d9b27bcc6e11e117ee974916e091.camel@HIDDEN>
 <CAJ3okZ1TQTPiNMkei1vYy_GixUtUh+NVsbpjb=qJq-Z7UnDHQA@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-+33rIk7edC1uwJlpKUCa"
User-Agent: Evolution 3.38.3-1 
MIME-Version: 1.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22;
 t=1653652154; bh=4P5dbjnaGULbIKPZG7djTVanZAmXv+6S80sSL+F+rk8=;
 h=Subject:From:To:Cc:Date:In-Reply-To:References;
 b=iGP17hiO64SueU/1xVZvfxt9OFxZAyszr+R1K0gtH0Yh0WLAT85gX2pGm19LGYIsp
 GfHU7DERUpB5xDlt576Wm9PCeW7oa2o88FzhqyJnTByoC1l9o4wl4PtkxRiOA4xhoG
 ZzTzHO8hGt88ePXGDSJMIk6EoAVWtp6z7TZu2YWzxvPCVP6kusr2GtCYWLluASJl/v
 jzndqvjnSiJsREeI08/w6M/tiJvJn3bM79DGrIqjmEpSiqZhWkGg3BZXf1KpcCnoO1
 x2ECOC7jTQLKBg3R6MiFLvLBahXI5F9lhA83yW69wPJFQRFRNTs7ogOn7/KwJSXlz/
 nZwFXSxENI8og==
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55673
Cc: 55673 <at> debbugs.gnu.org, Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--=-+33rIk7edC1uwJlpKUCa
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

zimoun schreef op vr 27-05-2022 om 13:39 [+0200]:
> The only case is when 'read' fails.=C2=A0 Personally, I do not see how it
> would be possible.=C2=A0 If you have a concrete example, then we can
> examine.

I don't have a 100%-concrete example, but wasn't there some file system
crash mode, where the contents of a new file has not yet been written
to disk yet the length of the file is > 0, so effectively the file
points to an arbitrary range on the disk?  E.g., say Guix told the FS
write 1234 to last-expiry-cleanup.  Then the FS created last-expiry-
cleanup, choose a range of 4 bytes to save it as, then crashes before
writing the contents.  After restarting, the file contains the _old_ 4
bytes.

These old 4 bytes could be the ASCII representation of

  "foo

.  Then, when 'read' is run (after rebooting), it sees an incomplete
string "foo, so it fails.

Greetings,
Maxime.

--=-+33rIk7edC1uwJlpKUCa
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYpC6tBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7qo5AP9PG6k+5mhppXv1EmyFZqN5Ei4c
vRUZTQ4+luOGOMR4iwEAqw2kaJX02uPQfwDbDDOkWClCugIn9QGRISSnSEvFKAw=
=ejKM
-----END PGP SIGNATURE-----

--=-+33rIk7edC1uwJlpKUCa--





Information forwarded to guix-patches@HIDDEN:
bug#55673; Package guix-patches. Full text available.

Message received at 55673 <at> debbugs.gnu.org:


Received: (at 55673) by debbugs.gnu.org; 27 May 2022 11:40:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 07:40:33 2022
Received: from localhost ([127.0.0.1]:32944 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nuYKX-0005vE-0g
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 07:40:33 -0400
Received: from baptiste.telenet-ops.be ([195.130.132.51]:36466)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1nuYKU-0005v4-Pg
 for 55673 <at> debbugs.gnu.org; Fri, 27 May 2022 07:40:31 -0400
Received: from [172.20.10.5] ([188.188.253.34])
 by baptiste.telenet-ops.be with bizsmtp
 id bngU270040lHqdo01ngUvn; Fri, 27 May 2022 13:40:29 +0200
Message-ID: <0bafbbcf501fc13b9dab096bf03ce7e60afe1c4f.camel@HIDDEN>
Subject: Re: [bug#55673] [PATCH] cache: Catch valid integer for
 'last-expiry-cleanup'.
From: Maxime Devos <maximedevos@HIDDEN>
To: zimoun <zimon.toutoune@HIDDEN>
Date: Fri, 27 May 2022 13:40:23 +0200
In-Reply-To: <CAJ3okZ2EAQLSbTPyQWPcJ4OjuX+qPf6m3N5goGEptEhsSYWV-A@HIDDEN>
References: <20220527082519.501697-1-zimon.toutoune@HIDDEN>
 <9432b1161007faacc0bd0e58da0bf839e2e8ec39.camel@HIDDEN>
 <CAJ3okZ2Rz3dvDC8qYs=DM2cP3ZQg1exHiRmYan-iDQ+0EtGctQ@HIDDEN>
 <22ddd5b3d9906b84b0f1ca79dc78964e59345a6d.camel@HIDDEN>
 <CAJ3okZ2EAQLSbTPyQWPcJ4OjuX+qPf6m3N5goGEptEhsSYWV-A@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-rE8zyxFy+1Jaj53eUyQR"
User-Agent: Evolution 3.38.3-1 
MIME-Version: 1.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22;
 t=1653651629; bh=KaVCoeNxMRG6cVrieEyU3q0K9f1qzJIYe+7tHpVbkfg=;
 h=Subject:From:To:Cc:Date:In-Reply-To:References;
 b=K3DIfMkMbN2Doxz+CO89wS+JfdgNMXKnF2PCU8f5wL6DjwwrBpVzf2XDebDfRh7iu
 /q8C++QNjNbisJ7+JxAQx39ITdMMLhYhSkozTLk5lkqeopN4hHxDf7knjQaxRYNk8C
 +N7hcSv6bRJWjTMI/NsGSZMRSICu5+FwM9Wmcwpr9KQx8reLppwRnoHgsUKDMriOWe
 X/x0/lvVh697I3z40VGduT6NP65CFv3aH9WS5VjGxBfUrhGao3bj2XSCT9aWu/V11F
 T78iHw+GT6hGSUMhhjWdLzTi5hW6kxexRrx7xrR0ouH5B/Eas42Epql0n5pZaZPpFM
 koaDbiQagUJ9Q==
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55673
Cc: 55673 <at> debbugs.gnu.org, Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--=-rE8zyxFy+1Jaj53eUyQR
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

zimoun schreef op vr 27-05-2022 om 13:24 [+0200]:
> On Fri, 27 May 2022 at 13:17, Maxime Devos <maximedevos@HIDDEN> wrote=
:
>=20
> > scheme@(guile-user)> (call-with-input-file "." read)
> > ice-9/boot-9.scm:1669:16: In procedure raise-exception:
> > In procedure fport_read: Is een map
>=20
> Euh, you are overengineering, no?  We are talking about an internal
> file used by the Guix cache.  Yes, if the user tweaks this cache, then
> bad things can happen.  It is true for almost what lives in
> ~/.cache/guix.

Probably yes.  Maybe it makes more sense when applied to get-string-all
+ string->number in a limited form:

   (or (string->number
         (catch 'system-error
           (lambda () (call-with-input-file [...] get-string-all))
           (lambda arglist
             (if (=3D ENOENT (system-error-errno arglist))
                 "0" ; file does not exist
                 (apply throw arglist)))))
       0)

Though even then there remain potential problems, try

scheme@(guile-user)> (string->number "#e1e1000")
ice-9/boot-9.scm:1669:16: In procedure raise-exception:
In procedure string->number: Value out of range: 1000

(seems unlikely to encounter such corruption in practice though).

Greetings,
MAxime.

--=-rE8zyxFy+1Jaj53eUyQR
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYpC4pxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7kjUAQCJLEmo38K+tLP+UCxxOjaUPHmK
7XpeSjxAW7yPCkl1PgEAq0BTdH3PVeTVIKJJul5JX4gUpCkmuHiv17TeSn0iegc=
=pLaM
-----END PGP SIGNATURE-----

--=-rE8zyxFy+1Jaj53eUyQR--





Information forwarded to guix-patches@HIDDEN:
bug#55673; Package guix-patches. Full text available.

Message received at 55673 <at> debbugs.gnu.org:


Received: (at 55673) by debbugs.gnu.org; 27 May 2022 11:39:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 07:39:40 2022
Received: from localhost ([127.0.0.1]:32939 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nuYJg-0005tW-OL
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 07:39:40 -0400
Received: from mail-pg1-f179.google.com ([209.85.215.179]:36742)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1nuYJd-0005tH-2V
 for 55673 <at> debbugs.gnu.org; Fri, 27 May 2022 07:39:39 -0400
Received: by mail-pg1-f179.google.com with SMTP id h186so3729109pgc.3
 for <55673 <at> debbugs.gnu.org>; Fri, 27 May 2022 04:39:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=WKL43uHFFu5f60mylrYS59xTUeiBL51IhIssdyTVHvo=;
 b=O0ycgTrrIqL0nj7mU7Arb3C+7ckA7zWF4KPUNn3hbDmojybx2o/rYwLeREsJeO8KRh
 KeWsf37aIrc/YFQYQ8nLOiSv4FmXNbKlfQsGfSQvltZYcFMTRGMbxiyDBa/N0BDa/CHD
 TowfIzM1PIHul7/eOXw3GWwtmDC8lgQjmXY8i1yzvLosIGa2WUuKulfYyIX1/cs63C+9
 C/XIkcrF3AMfFVr15ChnVEq/HrMn4e6ByGb7PvjYoAdyr7cWn8uqbEwzcOGu6KJnVYfI
 /4Kz9oli9fBSkhkHF8KwL4dZeDpAsB3hcpwAw5ImEgYNZpkuulBIQacQ+5wY+oorCI7O
 TKGg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=WKL43uHFFu5f60mylrYS59xTUeiBL51IhIssdyTVHvo=;
 b=XB99c3cvBkiDJmhNx6UOL1dowfrqIQ0/BE8egwPIarYVCG8p9JI27qgxd0nPNTjTec
 KP9zQ+J90FNUHrqFM7Bsk0NI14YRAF/JSlDg1Sb5F/0rGVJazkDLs9s3Pv4BYzqdP/OO
 gptwwesAvdPSFqFRrcJpiOBpSccED8hSi7MPeRcBvloF8LqPeqFG4zgu9p+deQtXynD6
 vbccFqp03aW7Qilfy8sYSqAs4/a4UwhnCMp/rQ2qSsWeqreZZguSL4JcHDKE/FCYLOoV
 NVuw6zDLGNkjgewNXsoPbfJgR4QsymPnbd7ksXHB/iGxj5G0xauO8U2siq0GkRRl20KK
 BeWg==
X-Gm-Message-State: AOAM5315xqUh9KDwINgho+9TaOPMxVtH5g13aHatkVCkjnxnr/BZe/8q
 4djd5O1pJeXZCPiLPmRHkbjFsilL1Kdr+ltoUeM=
X-Google-Smtp-Source: ABdhPJxx0U/ga7e7wixiiSTr5XZFEoImmsjbXrr37NCnDEPA51wIvUSN9V/BSgVV0Cf9R+B4sU9P/XeYcxu1xRDldJw=
X-Received: by 2002:a65:5c48:0:b0:382:2c7:28e9 with SMTP id
 v8-20020a655c48000000b0038202c728e9mr37657107pgr.472.1653651571064; Fri, 27
 May 2022 04:39:31 -0700 (PDT)
MIME-Version: 1.0
References: <20220527082519.501697-1-zimon.toutoune@HIDDEN>
 <9432b1161007faacc0bd0e58da0bf839e2e8ec39.camel@HIDDEN>
 <CAJ3okZ2Rz3dvDC8qYs=DM2cP3ZQg1exHiRmYan-iDQ+0EtGctQ@HIDDEN>
 <24883447c6f3d9b27bcc6e11e117ee974916e091.camel@HIDDEN>
In-Reply-To: <24883447c6f3d9b27bcc6e11e117ee974916e091.camel@HIDDEN>
From: zimoun <zimon.toutoune@HIDDEN>
Date: Fri, 27 May 2022 13:39:19 +0200
Message-ID: <CAJ3okZ1TQTPiNMkei1vYy_GixUtUh+NVsbpjb=qJq-Z7UnDHQA@HIDDEN>
Subject: Re: [bug#55673] [PATCH] cache: Catch valid integer for
 'last-expiry-cleanup'.
To: Maxime Devos <maximedevos@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55673
Cc: 55673 <at> debbugs.gnu.org, =?UTF-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Fri, 27 May 2022 at 13:12, Maxime Devos <maximedevos@HIDDEN> wrote:

> But what if the computer crashes while the file is being made, and due
> to file system details, when rebooted, you end up with a non-integer?
> E.g. "unterminated-string.

If the value returned by 'read' is a non-integer, then it is set to 0
by the 'match'.

--8<---------------cut here---------------start------------->8---
$ echo -n -e \\x00\\x01\\x02\\x03 > ~/.cache/guix/inferiors/last-expiry-cleanup
$ cat ~/.cache/guix/inferiors/last-expiry-cleanup
\0 [env]
$ ./pre-inst-env guix time-machine --commit=9d795fb -- help
1653651128[env]
--8<---------------cut here---------------end--------------->8---

The only case is when 'read' fails.  Personally, I do not see how it
would be possible.  If you have a concrete example, then we can
examine.


Cheers,
simon




Information forwarded to guix-patches@HIDDEN:
bug#55673; Package guix-patches. Full text available.

Message received at 55673 <at> debbugs.gnu.org:


Received: (at 55673) by debbugs.gnu.org; 27 May 2022 11:24:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 07:24:24 2022
Received: from localhost ([127.0.0.1]:32924 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nuY4u-0003Ko-2m
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 07:24:24 -0400
Received: from mail-pg1-f173.google.com ([209.85.215.173]:46061)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1nuY4o-0003KY-Qg
 for 55673 <at> debbugs.gnu.org; Fri, 27 May 2022 07:24:22 -0400
Received: by mail-pg1-f173.google.com with SMTP id l184so1090370pge.12
 for <55673 <at> debbugs.gnu.org>; Fri, 27 May 2022 04:24:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=VPdDOz7yEOlS7uYmtLMebnjxZq2STyLefRvZZY3A8Ng=;
 b=DP8f5l4mih/bAx5rUonb7ecz4FwFkVKwTItZi2RERUPmnLwz4ztl9rTI7kjMs05xl5
 M1A37JBxp92yHZP2C7BFbt/dd0pQ7umiwX7hX45/FFtn4SSZouBW+puW6aNNwGs4gs5f
 uEUOashmqBOEnOEBDtvrut6O0yNBdQM9AfkHC5AKUpowPzZQQ8tXZeo/1fBZvtRHjGPk
 NM3q0+f0Uo84r7MO9Kq9NS3LkrZlRLmm7ljfDpMePx4nUIoAsTr6SM7EVLTLEw1RNZol
 QlVLTp/cNTC1OlcKhhVM40UJuFGnGGfY3rPCA5uKGkasZc8EqJs0OpWlxo0yHsZ2uH2e
 yVuQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=VPdDOz7yEOlS7uYmtLMebnjxZq2STyLefRvZZY3A8Ng=;
 b=8FtL6xPl2wHffVqbcYedbsSL+KETnFAHDTAJQma264qfi335YzQvPD9JBYSArTm0qC
 BL9oIUjRoklTdmGlojKQaR0QQGuo5AQzDRtwbnhId35+yEWhakNoC71x4aBe1n0Tfagz
 Mdz+qP+tYKOaq1wqe6sn5ID0WUK+qmYGjbAf7/QFEtM3xora738D3litRkVzpYO6pohl
 moPy0569CWzX62coDSYPCD6MqpwzsfifssG3D+JCJzqtMM1UutqpMQMkdrDXns8p+TUB
 n1bvTZv8BwBpE0JTOLT3USeUn54t428tQbPKXixR9X2rHrO/QDPSpQ+tgLXSsUUNs8yP
 39Qg==
X-Gm-Message-State: AOAM533F/PhLNOTZIfCOWozmcGEnlBMPaORNPVvtwP2E4HUYvcbf1L1C
 veioB/5rxBz3vJUtXyloOVDVX4uBEEwPeDoHqRM=
X-Google-Smtp-Source: ABdhPJybKwwUMvaINDekWzPNNywUyC5b5rEONA7wuezqinRxOv6vWWIvfjhnDaEmB8qce0oxqhFkjHxwrmgyron1Bmc=
X-Received: by 2002:a05:6a00:b90:b0:518:f567:ffb6 with SMTP id
 g16-20020a056a000b9000b00518f567ffb6mr13739553pfj.80.1653650652982; Fri, 27
 May 2022 04:24:12 -0700 (PDT)
MIME-Version: 1.0
References: <20220527082519.501697-1-zimon.toutoune@HIDDEN>
 <9432b1161007faacc0bd0e58da0bf839e2e8ec39.camel@HIDDEN>
 <CAJ3okZ2Rz3dvDC8qYs=DM2cP3ZQg1exHiRmYan-iDQ+0EtGctQ@HIDDEN>
 <22ddd5b3d9906b84b0f1ca79dc78964e59345a6d.camel@HIDDEN>
In-Reply-To: <22ddd5b3d9906b84b0f1ca79dc78964e59345a6d.camel@HIDDEN>
From: zimoun <zimon.toutoune@HIDDEN>
Date: Fri, 27 May 2022 13:24:01 +0200
Message-ID: <CAJ3okZ2EAQLSbTPyQWPcJ4OjuX+qPf6m3N5goGEptEhsSYWV-A@HIDDEN>
Subject: Re: [bug#55673] [PATCH] cache: Catch valid integer for
 'last-expiry-cleanup'.
To: Maxime Devos <maximedevos@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55673
Cc: 55673 <at> debbugs.gnu.org, =?UTF-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Fri, 27 May 2022 at 13:17, Maxime Devos <maximedevos@HIDDEN> wrote:

> scheme@(guile-user)> (call-with-input-file "." read)
> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
> In procedure fport_read: Is een map

Euh, you are overengineering, no?  We are talking about an internal
file used by the Guix cache.  Yes, if the user tweaks this cache, then
bad things can happen.  It is true for almost what lives in
~/.cache/guix.


Cheers,
simon




Information forwarded to guix-patches@HIDDEN:
bug#55673; Package guix-patches. Full text available.

Message received at 55673 <at> debbugs.gnu.org:


Received: (at 55673) by debbugs.gnu.org; 27 May 2022 11:17:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 07:17:22 2022
Received: from localhost ([127.0.0.1]:32912 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nuXy5-0002wg-Oi
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 07:17:22 -0400
Received: from baptiste.telenet-ops.be ([195.130.132.51]:35376)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1nuXy2-0002tB-2s
 for 55673 <at> debbugs.gnu.org; Fri, 27 May 2022 07:17:20 -0400
Received: from [172.20.10.5] ([188.188.253.34])
 by baptiste.telenet-ops.be with bizsmtp
 id bnHG2700G0lHqdo01nHGCA; Fri, 27 May 2022 13:17:17 +0200
Message-ID: <22ddd5b3d9906b84b0f1ca79dc78964e59345a6d.camel@HIDDEN>
Subject: Re: [bug#55673] [PATCH] cache: Catch valid integer for
 'last-expiry-cleanup'.
From: Maxime Devos <maximedevos@HIDDEN>
To: zimoun <zimon.toutoune@HIDDEN>
Date: Fri, 27 May 2022 13:17:16 +0200
In-Reply-To: <CAJ3okZ2Rz3dvDC8qYs=DM2cP3ZQg1exHiRmYan-iDQ+0EtGctQ@HIDDEN>
References: <20220527082519.501697-1-zimon.toutoune@HIDDEN>
 <9432b1161007faacc0bd0e58da0bf839e2e8ec39.camel@HIDDEN>
 <CAJ3okZ2Rz3dvDC8qYs=DM2cP3ZQg1exHiRmYan-iDQ+0EtGctQ@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-iAXrXFrz0d4vEFvUfopi"
User-Agent: Evolution 3.38.3-1 
MIME-Version: 1.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22;
 t=1653650237; bh=/M4Inbifp/sFFCzaXkKJrV9o6S/NVvrpxP0p8KrOQxs=;
 h=Subject:From:To:Cc:Date:In-Reply-To:References;
 b=dU99Z2L5prgGHeAKt4YLyRA80GqJn5jJQiGAjlgf8W/l8WywLNPTjqbYKv5SIqxGI
 qs/L7fpJQfQ9u/Gfquji6IoF/iwhxBqZPzafTkcexNlvi425qwNT3B48NV1AMrsDM6
 Vt5qLvJdjtG6u7G1GRHYnh8N6m1xtQvB0NNNdbe2fkq2y2VR2rwiaeF6Tf8N4zKd3a
 YiPTZQh/U3XWPods2HiLxjgZMJycZBY7OHnX+XVLYpnO40SMTlUuA8fHsIRuTUoOBh
 zIrCiH1CtR7C08iiepevgZAcK0rj8lIg+ZlVmJuIsvz6QaAfUOkbyibkMFT4o4J0IB
 692oMw8+zFsyg==
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55673
Cc: 55673 <at> debbugs.gnu.org, Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--=-iAXrXFrz0d4vEFvUfopi
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

zimoun schreef op vr 27-05-2022 om 12:28 [+0200]:
> > Also, I'd switch the catch and the (match ...) because 'read' and
> > integer? shouldn't raise any 'system-error'.
>=20
> All the cases are covered, IMHO.

Too many cases are covered.  E.g., what if the file was a directory?

scheme@(guile-user)> (call-with-input-file "." read)
ice-9/boot-9.scm:1669:16: In procedure raise-exception:
In procedure fport_read: Is een map

Greetings,
Maxime.

--=-iAXrXFrz0d4vEFvUfopi
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYpCzPBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7qPoAQD7aCZXfdItRx4XPRgOOLW8IEZ1
jH20EGIIshZKl3pN+QEAsWJZzPSMkah+eh+hf8iMctpBmMXmMl0IUjn6e+hxyQc=
=0Ksy
-----END PGP SIGNATURE-----

--=-iAXrXFrz0d4vEFvUfopi--





Information forwarded to guix-patches@HIDDEN:
bug#55673; Package guix-patches. Full text available.

Message received at 55673 <at> debbugs.gnu.org:


Received: (at 55673) by debbugs.gnu.org; 27 May 2022 11:12:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 07:12:53 2022
Received: from localhost ([127.0.0.1]:32907 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nuXtl-0000sT-7K
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 07:12:53 -0400
Received: from baptiste.telenet-ops.be ([195.130.132.51]:57734)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1nuXtj-0000sJ-Ag
 for 55673 <at> debbugs.gnu.org; Fri, 27 May 2022 07:12:52 -0400
Received: from [172.20.10.5] ([188.188.253.34])
 by baptiste.telenet-ops.be with bizsmtp
 id bnCo2700N0lHqdo01nCoE9; Fri, 27 May 2022 13:12:49 +0200
Message-ID: <24883447c6f3d9b27bcc6e11e117ee974916e091.camel@HIDDEN>
Subject: Re: [bug#55673] [PATCH] cache: Catch valid integer for
 'last-expiry-cleanup'.
From: Maxime Devos <maximedevos@HIDDEN>
To: zimoun <zimon.toutoune@HIDDEN>
Date: Fri, 27 May 2022 13:12:48 +0200
In-Reply-To: <CAJ3okZ2Rz3dvDC8qYs=DM2cP3ZQg1exHiRmYan-iDQ+0EtGctQ@HIDDEN>
References: <20220527082519.501697-1-zimon.toutoune@HIDDEN>
 <9432b1161007faacc0bd0e58da0bf839e2e8ec39.camel@HIDDEN>
 <CAJ3okZ2Rz3dvDC8qYs=DM2cP3ZQg1exHiRmYan-iDQ+0EtGctQ@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-0wDSiBAWS2r3RBlQeURS"
User-Agent: Evolution 3.38.3-1 
MIME-Version: 1.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22;
 t=1653649969; bh=00z/H1zefrsDqTex5tQxKSi8x+tN4NRMcR+ntrbClps=;
 h=Subject:From:To:Cc:Date:In-Reply-To:References;
 b=JEhXYDNMIYFTYmRmzAZ5d92wIRzCjj059aoGamNTnFdXUJ1kspNiLmmDYNtHIy+L6
 Mb8VQD/pyvyIyR831z+09WLi/Ce7zf6xre8jaSZFQVOgmtPw6WOiK2a/WK124de5Bd
 sqD50Sh1C2otx4jkRYPfBWpubdXoRnJYdG0j18xLXMDrKmBogdhIX42GS6YQAt6icD
 MRZNKxp/PozU5z1WORomXpYxPIPcsFXy8KzXNwUjooHruuWpno+/qE64B5RXN1YSy5
 AFznuMYhGJnQw1MUJ0rzVCo7ECAB0D5PA05osMRmMpDwqgMGq5eFRJwVLbiBicOGxB
 y0JtMc+06j0XA==
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55673
Cc: 55673 <at> debbugs.gnu.org, Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--=-0wDSiBAWS2r3RBlQeURS
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

zimoun schreef op vr 27-05-2022 om 12:28 [+0200]:
> > It might be possible to end up wit hsomething more bogus on some
> > file
> > system, it's possible to end up with something even more boguse
> > (e.g.,
> > "unterminated-string), which 'read' doesn't understand.=C2=A0 I suggest
> > using 'get-string-all' + 'number->string'.
>=20
> I do not see how.=C2=A0 The integer is written by Guile using 'write'.
> From my understanding, 'read' understands 'write', and vice-versa.

But what if the computer crashes while the file is being made, and due
to file system details, when rebooted, you end up with a non-integer?
E.g. "unterminated-string.

Greetings,
Maxime.

--=-0wDSiBAWS2r3RBlQeURS
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYpCyMBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7gT8AQD2twn1+E72CzCF9kLMvtQWTUFo
yITl2m/GN9JUzvttrwD/UDUQcO+I2D/DRY4wySSsxMlAo3n7uXDN6xNo6nO1gwU=
=iTSw
-----END PGP SIGNATURE-----

--=-0wDSiBAWS2r3RBlQeURS--





Information forwarded to guix-patches@HIDDEN:
bug#55673; Package guix-patches. Full text available.

Message received at 55673 <at> debbugs.gnu.org:


Received: (at 55673) by debbugs.gnu.org; 27 May 2022 10:28:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 06:28:53 2022
Received: from localhost ([127.0.0.1]:32813 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nuXDB-0005wD-LP
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 06:28:53 -0400
Received: from mail-pf1-f175.google.com ([209.85.210.175]:36815)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1nuXD8-0005vm-D9
 for 55673 <at> debbugs.gnu.org; Fri, 27 May 2022 06:28:50 -0400
Received: by mail-pf1-f175.google.com with SMTP id f21so3991360pfa.3
 for <55673 <at> debbugs.gnu.org>; Fri, 27 May 2022 03:28:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=Xb9TrqF2yXM/kxS+Br2W66bOVe4fqdzjhpuXXN4isdY=;
 b=TMQ3Y3XYVo+F+BIUPnQBhQKxo3SHKQPvw24TooGc0WHiu7rcMI74F7A9xqfXE7PF+L
 AsYUDmFcm9ATRSC0p8FYqXgJuz9BAlD2oMVo8pAmr6PY/FlabPbT8rOQyV8ErhfDwmXy
 7cgWG35AAK2+pgLqBMfhMHllakAmyQ35MigX48KY0+aAk6Gc8lxARYjOMp4SSvQN9kFD
 EkePgFkI5tnQx6HbKfmzfGrzPl2Z85raal6ZhiQvGAAH6rNjGIUvhVtQt4qN5LrMVeTs
 hpgXrBUy9yoSHUoqyxQ8T5PlPCMIBI+ocSgMgeeKH0+zorwSdnDnD5/nC22MbN+9aWZv
 lQ4Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=Xb9TrqF2yXM/kxS+Br2W66bOVe4fqdzjhpuXXN4isdY=;
 b=nDvah1E+YzpVmKRw8PtNVO5gijpcxZmjp3mrgU4XtSpR2dt/q/GlqJY0PXjh13HuE2
 Z0+ndigUWbcrPBXDAGTvs88r+EkcrQ9gX/FN2WEix0EgLuCxJlp0jMrYsKkpFtZ6Fub1
 P7ZzEP5NVLGFt/Ldy0c43sTrBqYxmj3UqTKW7hk/apb5RHlRW24UyZKMeQSbxPJO/g9W
 DA3vBQuse5UWtl+wE9C7qsAjkOQq0UUjnIx8MTCu/sHnd9nBJbDUFXQHBHrBHQcJhOM9
 HiDHP3i+Ao+71KQDpoz+8l+AOpVstBeJr7IbCPfTOOaLTcY2gXxRBKgO4HVV3Rrst9LA
 BFxQ==
X-Gm-Message-State: AOAM530QptADF/Zw8VaI1yAHLb3aGhTKwDsDFPx0XB/NGmeBN+fXL1+X
 XL7ye0D9QglGFCci74JM5M3GbPcqdZ0PqhZRCi4=
X-Google-Smtp-Source: ABdhPJyProSZ0SXtt5NhBB5zwyrbXCwTXVVRxV/oU10lz65mCVDRoe8tkcntF2SLVkXB+j4ihnPwVod1P9J+ESS7u70=
X-Received: by 2002:aa7:9e1e:0:b0:518:3ee0:57a7 with SMTP id
 y30-20020aa79e1e000000b005183ee057a7mr41997995pfq.42.1653647324501; Fri, 27
 May 2022 03:28:44 -0700 (PDT)
MIME-Version: 1.0
References: <20220527082519.501697-1-zimon.toutoune@HIDDEN>
 <9432b1161007faacc0bd0e58da0bf839e2e8ec39.camel@HIDDEN>
In-Reply-To: <9432b1161007faacc0bd0e58da0bf839e2e8ec39.camel@HIDDEN>
From: zimoun <zimon.toutoune@HIDDEN>
Date: Fri, 27 May 2022 12:28:33 +0200
Message-ID: <CAJ3okZ2Rz3dvDC8qYs=DM2cP3ZQg1exHiRmYan-iDQ+0EtGctQ@HIDDEN>
Subject: Re: [bug#55673] [PATCH] cache: Catch valid integer for
 'last-expiry-cleanup'.
To: Maxime Devos <maximedevos@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55673
Cc: 55673 <at> debbugs.gnu.org, =?UTF-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Maxime,

On Fri, 27 May 2022 at 11:54, Maxime Devos <maximedevos@HIDDEN> wrote:
> zimoun schreef op vr 27-05-2022 om 10:25 [+0200]:

> >      (catch 'system-error
> >        (lambda ()
> > -        (call-with-input-file expiry-file read))
> > +        (match (call-with-input-file expiry-file read)
> > +          ((? integer? date) date)
> > +          (_ 0)))
>
> It might be possible to end up wit hsomething more bogus on some file
> system, it's possible to end up with something even more boguse (e.g.,
> "unterminated-string), which 'read' doesn't understand.  I suggest
> using 'get-string-all' + 'number->string'.

I do not see how.  The integer is written by Guile using 'write'.
From my understanding, 'read' understands 'write', and vice-versa.


> Also, I'd switch the catch and the (match ...) because 'read' and
> integer? shouldn't raise any 'system-error'.

All the cases are covered, IMHO.


Cheers,
simon




Information forwarded to guix-patches@HIDDEN:
bug#55673; Package guix-patches. Full text available.

Message received at 55673 <at> debbugs.gnu.org:


Received: (at 55673) by debbugs.gnu.org; 27 May 2022 09:54:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 05:54:20 2022
Received: from localhost ([127.0.0.1]:60995 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nuWfj-0004uh-VU
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 05:54:20 -0400
Received: from baptiste.telenet-ops.be ([195.130.132.51]:59624)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1nuWfh-0004uW-65
 for 55673 <at> debbugs.gnu.org; Fri, 27 May 2022 05:54:18 -0400
Received: from [172.20.10.5] ([188.188.253.34])
 by baptiste.telenet-ops.be with bizsmtp
 id bluE2700Q0lHqdo01luFL4; Fri, 27 May 2022 11:54:15 +0200
Message-ID: <9432b1161007faacc0bd0e58da0bf839e2e8ec39.camel@HIDDEN>
Subject: Re: [bug#55673] [PATCH] cache: Catch valid integer for
 'last-expiry-cleanup'.
From: Maxime Devos <maximedevos@HIDDEN>
To: zimoun <zimon.toutoune@HIDDEN>, 55673 <at> debbugs.gnu.org
Date: Fri, 27 May 2022 11:54:08 +0200
In-Reply-To: <20220527082519.501697-1-zimon.toutoune@HIDDEN>
References: <20220527082519.501697-1-zimon.toutoune@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-EtWzOHp64KEoovqfWoSG"
User-Agent: Evolution 3.38.3-1 
MIME-Version: 1.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22;
 t=1653645255; bh=D6rrqu53pDkHmLklfZaBvvgDUJBE63hoB8NHWjuXNCI=;
 h=Subject:From:To:Cc:Date:In-Reply-To:References;
 b=b/5I+41Zs1BT3kcd83aPqKtc8oH2HuXgXqA89UPDK5ZwfxT3SQn1KIEIdKVhrmgSa
 /k7LFViqWv0RGhF+NEnmkostiRCn61I3nv1/47b9HxRt2stdQRojWUEeDXn1UdRlyV
 TduQoZEVTCo67tAhXu89jBCVdD8n9QA1lWb50OA9Bumouqhgn0XwedgOO8nPbQNzjf
 ht1IPf3Be52sPplzuKMS4skKbaeJ5WB6yYYmM3H12K6wlSPm+yAKqYUF0PjGVp0F7O
 zNLJvWmCz/BtX+0/FvUnB/I7uDJduj5rFqQ7dALFxTtKVTpvguB0IbcvmuLGY1J5YD
 XUY0iAuzL4hDA==
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55673
Cc: ludo@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--=-EtWzOHp64KEoovqfWoSG
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

zimoun schreef op vr 27-05-2022 om 10:25 [+0200]:
> =C2=A0=C2=A0=C2=A0=C2=A0 (catch 'system-error
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (lambda ()
> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (call-with-input-file expiry-=
file read))
> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (match (call-with-input-file =
expiry-file read)
> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((? integer? date=
) date)
> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (_ 0)))

It might be possible to end up wit hsomething more bogus on some file
system, it's possible to end up with something even more boguse (e.g.,
"unterminated-string), which 'read' doesn't understand.  I suggest
using 'get-string-all' + 'number->string'.

For completeness, a comment like

   ;; Handle the 'write' below being interrupted before the write
   ;; could complete (e.g. with C-c) and handle file system crashes
   ;; causing empty files or corrupted contents.

and a regression test in tets/cache.scm would be nice.

Also, I'd switch the catch and the (match ...) because 'read' and
integer? shouldn't raise any 'system-error'.

Greetings,
Maxime.

--=-EtWzOHp64KEoovqfWoSG
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYpCfwBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7jJVAQCaikLYy+Q0fz7265EtiZpF0YnO
jfA8iEbv9sQ37hbOiAD+ME5hYi9Wi481pHOf9HcNcP3/5qC9ozWIkkliKc/tgAI=
=4B9U
-----END PGP SIGNATURE-----

--=-EtWzOHp64KEoovqfWoSG--





Information forwarded to guix-patches@HIDDEN:
bug#55673; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 27 May 2022 08:25:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 04:25:42 2022
Received: from localhost ([127.0.0.1]:60869 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nuVHy-0000OG-GM
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 04:25:42 -0400
Received: from lists.gnu.org ([209.51.188.17]:51790)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1nuVHu-0000O7-5G
 for submit <at> debbugs.gnu.org; Fri, 27 May 2022 04:25:41 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:57864)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <zimon.toutoune@HIDDEN>)
 id 1nuVHt-0004BV-SH
 for guix-patches@HIDDEN; Fri, 27 May 2022 04:25:37 -0400
Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:40881)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <zimon.toutoune@HIDDEN>)
 id 1nuVHs-0001e7-8I
 for guix-patches@HIDDEN; Fri, 27 May 2022 04:25:37 -0400
Received: by mail-wm1-x334.google.com with SMTP id
 v4-20020a1cac04000000b00397001398c0so4129687wme.5
 for <guix-patches@HIDDEN>; Fri, 27 May 2022 01:25:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=kwl/jxl6bTPVOGIUYZpAj/MGFQ5rdihSQNLywXdnc94=;
 b=WarJQPhQpznCan5Z020wEvswhpZBy2CQTZJMpQgDE2yeDcTt34JqlbQcsZS85ZAezj
 8BfBuA6Avswb9H/4m6iX1WpX0ixUmp5vM6LL433x1efe4NTeytdQtRTuGn4Ozb9t9LrV
 5qimGZ0NexDu/6nQgIpc/UnfHMHQTVftw05CRb+S0vIGarXNKHqJ4pvSVTRBgU6mCGkn
 PNFWGjDtpVWMsUMv9jRfZwIqHabLVGNEFHajKt1hGFNjDR1yTtjZeH83sZaKJxGEAi+h
 3ZLjHOda7teJ7iII5zBXgvTihZYV0hu2rCD4e/rMrBYjYtyZHoV0uARuZE5huLOdC+LQ
 CwCQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=kwl/jxl6bTPVOGIUYZpAj/MGFQ5rdihSQNLywXdnc94=;
 b=qK9eUOs4ijeuHpGy/8WO0S/CDQWjNQPF943PkZVfEjtyU/uE4GTh2PVCYMiepPupjK
 nbfn3PS/vCquzWKi6KAll0sxFj2MmfmNu7TE53xxxw9Mz9xDkWLjqr0/fzCoKq6Rqte+
 qHtjghdpABV9DQQPvlg2AD6IClSHTXK3FFzDd6TZoT0FpgpdnQfzDUzpKyEIbA7EEEBZ
 VOkFu9RhEtJMvupFhi0lzyt2QyiDJ9/X22c4AdTuTaTdonbVMulaEriVgKsMbtjVe8kN
 P3WNW00pjp2WYHXNkKqEw5mGAUjS+2a8zmY3UdHFYc8QKzD0ITky1wKfauROjm4yDkEA
 Mhig==
X-Gm-Message-State: AOAM532OhMO/QcOdpqRcW68j8M0dbdqGkRzZc49yW4qhYCec1GxGjYcb
 Qu/jN+f1i+4ONVpSC88vmzsIURyA23U=
X-Google-Smtp-Source: ABdhPJwpXW8AKFFFIbPXl6ciz9r+B6XCeUhtPeDZ01vJAPwB2joM0xNhA2AmahUfYLunWOlYKurpQw==
X-Received: by 2002:a05:600c:3384:b0:397:6443:5343 with SMTP id
 o4-20020a05600c338400b0039764435343mr5662483wmp.124.1653639932722; 
 Fri, 27 May 2022 01:25:32 -0700 (PDT)
Received: from localhost.localdomain ([193.48.40.241])
 by smtp.gmail.com with ESMTPSA id
 e12-20020a05600c4e4c00b003974d0d981dsm1424287wmq.35.2022.05.27.01.25.31
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 27 May 2022 01:25:32 -0700 (PDT)
From: zimoun <zimon.toutoune@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] cache: Catch valid integer for 'last-expiry-cleanup'.
Date: Fri, 27 May 2022 10:25:19 +0200
Message-Id: <20220527082519.501697-1-zimon.toutoune@HIDDEN>
X-Mailer: git-send-email 2.36.0
MIME-Version: 1.0
X-Debbugs-CC: ludo@HIDDEN
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2a00:1450:4864:20::334;
 envelope-from=zimon.toutoune@HIDDEN; helo=mail-wm1-x334.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: zimoun <zimon.toutoune@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Fixes <http://issues.guix.gnu.org/55638>.

* guix/cache.scm (maybe-remove-expired-cache-entries)[last-expiry-date]: Check
if the date is a valid integer.
---
 guix/cache.scm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/guix/cache.scm b/guix/cache.scm
index 51009809bd..4a74c42afe 100644
--- a/guix/cache.scm
+++ b/guix/cache.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2020, 2021 Ludovic Courtès <ludo@HIDDEN>
+;;; Copyright © 2022 Simon Tournier <zimon.toutoune@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -93,7 +94,9 @@ (define expiry-file
   (define last-expiry-date
     (catch 'system-error
       (lambda ()
-        (call-with-input-file expiry-file read))
+        (match (call-with-input-file expiry-file read)
+          ((? integer? date) date)
+          (_ 0)))
       (const 0)))
 
   (when (obsolete? last-expiry-date now cleanup-period)

base-commit: 38bf6c7d0cb588e8d4546db7d2e0bae2ec25183d
-- 
2.36.0





Acknowledgement sent to zimoun <zimon.toutoune@HIDDEN>:
New bug report received and forwarded. Copy sent to ludo@HIDDEN, guix-patches@HIDDEN. Full text available.
Report forwarded to ludo@HIDDEN, guix-patches@HIDDEN:
bug#55673; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 27 May 2022 16:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.