Early detection of derivations with unreadable builder scripts

  • Open
  • quality assurance status badge
Details
2 participants
  • Josselin Poiret
  • Christopher Baines
Owner
unassigned
Submitted by
Christopher Baines
Severity
normal
C
C
Christopher Baines wrote on 8 Mar 2023 15:41
(address . bug-guix@gnu.org)
87bkl3qovn.fsf@cbaines.net
Currently it's quite easy to end up with packages that have builder
scripts that can't be read by Guile.

This is part of the following builder script:

(cons "--enable-mpi-java" #<gexp gnu/packages/mpi.scm:233:24 7f366e0cd930>)

from: /gnu/store/yngxnpcs4s6y8acxf4nwx5pcpj0j6q6i-java-openmpi-4.1.4-builder

And when attempting to build that derivation, you get the following
error.

ice-9/read.scm:126:4: In procedure read-expr*:
/gnu/store/yngxnpcs4s6y8acxf4nwx5pcpj0j6q6i-java-openmpi-4.1.4-builder:1:3820: Unknown # object: "#<"


It would be nice if Guix could detect this category of problems and
raise an error at the time the derivation is created, rather than the
error occuring only when you build the derivation.

This would be helpful particularly for the Guix Data Service since
currently it ends up storing these useless derivations, often many times
since the builder includes some often changing string (7f366e0cd930 in
the example above), so this is a common cause of spurious changes
between revisions (as often noted on qa.guix.gnu.org).
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmQIoIxfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9XdG9hAAnMc4vEW/M14zVU7wYxZjY5TBwPQrMQrK
kNv6pWdeXMcF7HZBntO+mdO6KEpS7XpplP4GrT/dwFgVdYSNr3c0G0SQLB1CTRUa
ya+6Bwo29wC3+eRIEJ5mURNp1htplThcUBPRmBkTP/A+Nv3pbds01dtH+UenkaAW
k7/AEPEwDGYihl6WeE00A0Kk7dHvMbb6yIx68aeXzW5sS/Kx3LTzqJRGX+2soPlk
Gxdp6KJOYvsxgbcMQTAxSIqZVfg4mXlOkKAVKZJprPHgBFfb7oRtZzcfKSQpelFg
ZZoacdaZcX5wMrAaWLeysXkGjIKbOvOwGfkj/BdMIbSj2xd0/O6aNNYu+tUwLxi0
zk2fMMBgsJzGFHeklEIWlGFvLa/0gd7mXIVr6xRnA6l28k+VKmWCb9XYZvEkh3HD
rS72TiRTwQPr3qc5Mg1pQz8tQiKENvkKYBWcsj/9DdsQMem9Sg/zZnlLRtupnqn0
j/vwfdwd0fG7cj9IFsrIZjuJw2E4c9jWvY8AI4ENOVko06JHwhJ4n/gHLsqcyyKW
hmwGdJg83zujDtERePP6o80M5EFdReBZRp2Wm+zcgFpXSeP1nbl+JwGgx7j6k4st
NuZw1Qhh5fkKhH9Mx5GMn6QVsDUozL2oNW8ko2azajEHMYKNDb6hah3obQ6sBDAI
LZjSO5E6tx8=
=TEma
-----END PGP SIGNATURE-----

J
J
Josselin Poiret wrote on 9 Mar 2023 21:51
(name . Ludovic Courtès)(address . ludo@gnu.org)
875yb9d4wo.fsf@jpoiret.xyz
Hi Chris,

Christopher Baines <mail@cbaines.net> writes:

Toggle quote (23 lines)
> This is part of the following builder script:
>
> (cons "--enable-mpi-java" #<gexp gnu/packages/mpi.scm:233:24 7f366e0cd930>)
>
> from: /gnu/store/yngxnpcs4s6y8acxf4nwx5pcpj0j6q6i-java-openmpi-4.1.4-builder
>
> And when attempting to build that derivation, you get the following
> error.
>
> ice-9/read.scm:126:4: In procedure read-expr*:
> /gnu/store/yngxnpcs4s6y8acxf4nwx5pcpj0j6q6i-java-openmpi-4.1.4-builder:1:3820: Unknown # object: "#<"
>
>
> It would be nice if Guix could detect this category of problems and
> raise an error at the time the derivation is created, rather than the
> error occuring only when you build the derivation.
>
> This would be helpful particularly for the Guix Data Service since
> currently it ends up storing these useless derivations, often many times
> since the builder includes some often changing string (7f366e0cd930 in
> the example above), so this is a common cause of spurious changes
> between revisions (as often noted on qa.guix.gnu.org).

We could probably modify sexp->string, or the builder bind in
gexp->derivation so that the sexp is sanity-checked for non-printable
things (we could even work on a whitelist basis). However, the
docstring of sexp->string talks about performance, and indeed "write" is
pure C code and very fast. I'd be reluctant to introduce a performance
hit that would be too heavy here.

This particular example though was caused by non-gexp #:phase arguments,
so another option could be to sanity check sexps given to sexp->gexp,
but again, the docstring talks about performance, so I'm not sure what
we should do here. In general, things written only with G-Exps should
work well, because you can't insert random stuff into them, but S-Exps
are more dangerous, hence why I think this option would be a better
middle ground.

Paging Ludo wrt. the performance cost of this (I can write a patch for
it adding a whitelist of what is allowed in a sexp->gexp sexp).

Best,
--
Josselin Poiret
-----BEGIN PGP SIGNATURE-----

iQHEBAEBCAAuFiEEOSSM2EHGPMM23K8vUF5AuRYXGooFAmQKRucQHGRldkBqcG9p
cmV0Lnh5egAKCRBQXkC5FhcairF2C/9DvmsylO9Z3Or/uXSpK0KU0N4PHAPtct66
NvokIcLbmrtkJGVKhGU2iNPeRrbxhYr60NOo2ESU/HifFWAqun3PKLaHDEZv/R+F
+X7B0Wo8/NxtjpLr1iHKU5Q7tKoVXWIO4KuQPmgPLJ7P1Tw2FNWJiNZPsbxixZBV
89XWrYjXNHMKh8SBhnWJq1lyWQH/tQNcNI2l9DDLvxh0z28oWZFASbj3WO8BOxzm
TLaFzPopM9iQ76eeUVbY0RjsGtSiBG2eatB7iJxFFio3SwA7YeqjlQR5+K2/MV/f
I/SPxyQa5voW5X4pasZtd4tNS8PYXervrmWZeNjPMYCbjAQ+ZtXX2LVbQi6KjR89
wI8DxL2apSopg6j4kZ8COEXtSJLwqDjiiVbJJ/ZDj0qnaiKWSMB1FR7elR+JqcmZ
xUoezWj8BgCkmPxzlwfYKf8UxexfI+mwGuUc3l7bmF4xCeqqIjLVn7FOuJYEgrRv
rJ2m1Hdj/5cT+UzuwHxJtRoQZmlrSg4=
=29Ui
-----END PGP SIGNATURE-----

?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 62051@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 62051
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch