bug#81238: Couple of SRFI-64 fixes
Tomas Volf via "Bug reports for GUILE, GNU's Ubiquitous Extension Language" <[email protected]> Sun, 19 Jul 2026 15:22:47 +0200
| Newsgroups | gmane.lisp.guile.bugs |
|---|---|
| Message-ID | <[email protected]> |
--=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable I apologize for somewhat later response, I did not manage to allocate some time to this sooner. :/ Olivier Dion <[email protected]> writes: > On Sat, 11 Jul 2026, Olivier Dion <[email protected]> wrote: >> On Sun, 12 Jul 2026, Tomas Volf <[email protected]> wrote: >> [...] >>> Should I send a patch, or for change of this size it will be faster for >>> you to just fix it? >> >> I'll fix it myself, just wanted to confirm with you :-) > > [...] > > Actually, can you just ensure that the following is okay? I stumble > across `test-result-ref' and saw that it was using `assoc-ref` directly, > which can return `#f' even if the key is present. I decided to use > match against `assoc' instead to be on the safe side. Well, that is (another) embarrassing bug. You are of course right and the proposed fix seem right. > > diff --git a/module/srfi/srfi-64.scm b/module/srfi/srfi-64.scm > index 98f6c8114..36daab2e7 100644 > --- a/module/srfi/srfi-64.scm > +++ b/module/srfi/srfi-64.scm > @@ -320,8 +320,10 @@ fail. This only affects test reporting, not test ex= ecution." > "Returns the property value associated with the @var{pname} property n= ame. > If there is no value associated with @var{pname} return @var{default}, or > @code{#f} if @var{default} is not specified." > - (or (assoc-ref (test-runner-result-alist runner) pname) > - default)) > + (match (assoc pname (test-runner-result-alist runner)) > + ((key . value) > + value) > + (#f default))) > > (define (test-result-set! runner pname value) > "Sets the property value associated with the @var{pname} property name= to > @@ -417,10 +419,12 @@ instead." > "Do nothing." > #f) > > +(define nothing (list 'nothing)) > + > (define (test-on-test-end-simple runner) > "Log that test is done." > (define (maybe-print-prop prop pretty? code) > - (let* ((default (list)) > + (let* ((default nothing) > (val (test-result-ref runner prop default))) > (unless (eq? val default) > (format #t "~a: ~@?~&" prop code val)))) I have applied the patch above to my tree (after s|/module/|/wolfsden/|) and all my tests are still passing. I have added test for #f in test-result-ref and manually verified the maybe-print-prop. I will keep the part for test-result-ref in my tree and credit it to you, however I believe that due to the size and character of this change, it does not pass the threshold for copyright, so I will not be installing LGPL text into the repository (my code is under AGPL). I hope that is fine with you, if not, just let me know and I will rewrite the patch from scratch. >=20=20=20=20=20=20=20=20=20=20 > Thanks, > Olivier Thank you ^_^ =2D-=20 There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJCBAEBCgAsFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmpcz6cOHH5Ad29sZnNk ZW4uY3oACgkQL7/ufbZ/wanO0w//W+3naKul1oJHhs9kLbFRIDdaebdJiBa1/HLf gD0H1umIHWYzNdPK/+mh1Ou9Nn9wE++1lEKigm9US24QVo9gozP03G3EXtUnidbK 3NdvtWxCI9b7TMvyKluV+6glnsWrqNJNuwHzwA5pF++DFdzvsi4p/LLiJ85xipTW eaqkTbU3HcuSkfOzAZ3KuGfnd7/iDXsF/2LT1j6gWCQh/LPYgGRZlrfHNgGMvTp/ B9Gya3KOOqCptjI8o4rjVKhGZtYI+UEhb5nHN7LRnuoPC58QzGnRQ3dGp9dYaTfr Y7ieGlTzmj/v0as2IJIg44Yj/qnWHZTH+tM3aTOJM/fy7m9vj3Hv5DdmHumkPkBg d0ppJ5F49pXBM8W5gyUyqwtiTu2Py0R9LEb5Yel5tlgksLsqfp/3CZCIm4cPq1SI fPHFn9l5kOtA1cCfjJZAoo+88xOUkpNA3UVgds7RKK1/vm+/tm/6waLlip3nQ009 Bws6/oeaMZXFM09ryDEL4GEKNSnTyC+j364LT2jmwh/ndcVyeIaxQZibA2mys4Wd 6vvsKkdqn0fR2qSF27Mj89s6wzwZbuutynLPQSICeLErUblCJcfgImOTMaLWBgeD UhuUEBCGAvAzKfzKDNGIloOQyLQE0VWJoIcVfbDlec/S9SzKaMXUgzM3CVJwteer Jj71TGE= =K4fS -----END PGP SIGNATURE----- --=-=-=--