unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#62051: Early detection of derivations with unreadable builder scripts
@ 2023-03-08 14:41 Christopher Baines
  2023-03-09 20:51 ` Josselin Poiret via Bug reports for GNU Guix
  0 siblings, 1 reply; 2+ messages in thread
From: Christopher Baines @ 2023-03-08 14:41 UTC (permalink / raw)
  To: 62051

[-- Attachment #1: Type: text/plain, Size: 1064 bytes --]

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).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#62051: Early detection of derivations with unreadable builder scripts
  2023-03-08 14:41 bug#62051: Early detection of derivations with unreadable builder scripts Christopher Baines
@ 2023-03-09 20:51 ` Josselin Poiret via Bug reports for GNU Guix
  0 siblings, 0 replies; 2+ messages in thread
From: Josselin Poiret via Bug reports for GNU Guix @ 2023-03-09 20:51 UTC (permalink / raw)
  To: Christopher Baines, 62051; +Cc: Ludovic Courtès

[-- Attachment #1: Type: text/plain, Size: 2080 bytes --]

Hi Chris,

Christopher Baines <mail@cbaines.net> writes:

> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 682 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-09 20:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 14:41 bug#62051: Early detection of derivations with unreadable builder scripts Christopher Baines
2023-03-09 20:51 ` Josselin Poiret via Bug reports for GNU Guix

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).