From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id SOu6KjmgkGIMSwEAbAwnHQ (envelope-from ) for ; Fri, 27 May 2022 11:56:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id WBOmKjmgkGL+NwEAauVa8A (envelope-from ) for ; Fri, 27 May 2022 11:56:09 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4A9FAD7DE for ; Fri, 27 May 2022 11:56:09 +0200 (CEST) Received: from localhost ([::1]:43608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nuWhU-0006jt-BR for larch@yhetil.org; Fri, 27 May 2022 05:56:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nuWgU-0006gU-Ei for guix-patches@gnu.org; Fri, 27 May 2022 05:55:34 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38865) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nuWgP-0007p9-V0 for guix-patches@gnu.org; Fri, 27 May 2022 05:55:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nuWgP-0004vj-Ra for guix-patches@gnu.org; Fri, 27 May 2022 05:55:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55673] [PATCH] cache: Catch valid integer for 'last-expiry-cleanup'. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 27 May 2022 09:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55673 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: zimoun , 55673@debbugs.gnu.org Cc: ludo@gnu.org Received: via spool by 55673-submit@debbugs.gnu.org id=B55673.165364526018895 (code B ref 55673); Fri, 27 May 2022 09:55:01 +0000 Received: (at 55673) by debbugs.gnu.org; 27 May 2022 09:54:20 +0000 Received: from localhost ([127.0.0.1]:60995 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nuWfj-0004uh-VU for submit@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 ) id 1nuWfh-0004uW-65 for 55673@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@telenet.be> From: Maxime Devos Date: Fri, 27 May 2022 11:54:08 +0200 In-Reply-To: <20220527082519.501697-1-zimon.toutoune@gmail.com> References: <20220527082519.501697-1-zimon.toutoune@gmail.com> 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1653645369; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=D6rrqu53pDkHmLklfZaBvvgDUJBE63hoB8NHWjuXNCI=; b=rDlnm8ITKQ5/KIjJoAnuen+RTT/nlxPqXnPug/35XylR7pyqCvEtOMreNGl/tgMMH89Ppl HitKvzfvRmOAvfILlr3KeufEVlJkpnx1T7e44mud/W5sWD7i1V2AsJnHiYrniyA9k0h3A0 U2HVipxNowbYy1EkdH30NcBybinEQKajU1I1SGnYN8IlvRCyQvUJh16FLrJNxx7W8HM/Zc /jeWNOSqOKS7dU2MMLerTk0iej3okAvZ10sn3JSHzW8YJ/4QEtuCb71sGYbSl8wtmN/VrP N/5sWdvlEBmdwePqX2IQRQeoYFu9TSoqixlHvGtYAMnhX85PVhrE/go3/8+Nhw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1653645369; a=rsa-sha256; cv=none; b=ayQjYe4JsclG38B4R55OeAlOyI7vdxc4/WY/UictehI1W3H62nXA4LQNaGABGCcEZuSRKE SiLDHDWOE/IL15gXH6VzZPYNJYWp4RTDudFZ//x6xyX/gLIBXp9k+S1h8Tmo/zUQhS1Auv Arwbt4odOZYe0BJ7br0aYw1B6ro9r5MUo4Yg2jMmTtwvnH119VcEDmQZ4/bbMpIeKIUaI5 Q+KVDf95BlqcmZBIAimMb9rkPsFLVUlrsJQvBIiIpbt489H4BbtH16w3be1ihiluiSu+Do x2AE46obiICoAhodlN1OkGXCzg/AQUBUu+8SEcOTtzjrILTpL278o5bU4TScUg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r22 header.b="b/5I+41Z"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 3.86 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r22 header.b="b/5I+41Z"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 4A9FAD7DE X-Spam-Score: 3.86 X-Migadu-Scanner: scn1.migadu.com X-TUID: qZHes2RV95qS --=-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--