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

From: zimoun <[email-masked]>
Date: Fri, 27 May 2022 12:28:33 +0200

Hi Maxime,

On Fri, 27 May 2022 at 11:54, Maxime Devos <[email-masked]> 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