Package example from cookbook has bugs

  • Open
  • quality assurance status badge
Details
2 participants
  • Maxime Devos
  • zimoun
Owner
unassigned
Submitted by
Maxime Devos
Severity
normal
M
M
Maxime Devos wrote on 5 Dec 2021 20:18
(address . bug-guix@gnu.org)
c28989ee4519f5c7b8bfaf6652b8dfbcb54d733c.camel@telenet.be
Hi guix,

The example at
two bugs:

#:tests? is unconditionally set to #true. This is bad for cross-
compilation and --without-tests=PACKAGE reasons, and would be flagged
by the linter.

In the new 'check' phase, libgit2_clar is invoked unconditionally. This
would be flagged by the linter.

Also, not exactly a bug, but still bad practice: the web page suggests:

#:make-flags (list (string-append "prefix=" (assoc-ref %outputs "out"))
"CC=gcc")

however, hardcoding gcc is bad for cross-compilation reasons. It should
use (cc-for-target) instead.

Greetings,
Maxime
Z
Z
zimoun wrote on 6 Dec 2021 15:30
86lf0xolfw.fsf@gmail.com
Hi Maxime,

On Sun, 05 Dec 2021 at 19:18, Maxime Devos <maximedevos@telenet.be> wrote:

Toggle quote (8 lines)
> The example at
> https://guix.gnu.org/cookbook/en/html_node/Extended-example.html has
> two bugs:
>
> #:tests? is unconditionally set to #true. This is bad for cross-
> compilation and --without-tests=PACKAGE reasons, and would be flagged
> by the linter.

For cross-compilation, yes. For ’--without-tests’, it is not an issue,
IMHO, or why is it?

Toggle quote (3 lines)
> In the new 'check' phase, libgit2_clar is invoked unconditionally. This
> would be flagged by the linter.

Since it is an example showing non-trivial things, maybe it can be
pedagogical to have something half good, if and only if, “guix lint”
reports the half bad. And add an explanation. WDYT?


Toggle quote (8 lines)
> Also, not exactly a bug, but still bad practice: the web page suggests:
>
> #:make-flags (list (string-append "prefix=" (assoc-ref %outputs "out"))
> "CC=gcc")
>
> however, hardcoding gcc is bad for cross-compilation reasons. It should
> use (cc-for-target) instead.

I agree.

Cheers,
simon
M
M
Maxime Devos wrote on 6 Dec 2021 16:10
bc2c9257d22665d3b532557e63f67605cc6514f4.camel@telenet.be
Hi,

zimoun schreef op ma 06-12-2021 om 15:30 [+0100]:
Toggle quote (10 lines)
> [....]
> > #:tests? is unconditionally set to #true. This is bad for cross-
> > compilation and --without-tests=PACKAGE reasons, and would be
> > flagged
> > by the linter.
>
> For cross-compilation, yes.  For ’--without-tests’, it is not an
> issue,
> IMHO, or why is it?

I was mistaken, unconditional #true is unproblematic for --without-
tests, because --without-tests replaces the #true by #false IIUC.

Toggle quote (8 lines)
> > In the new 'check' phase, libgit2_clar is invoked unconditionally.
> > This
> > would be flagged by the linter.
>
> Since it is an example showing non-trivial things, maybe it can be
> pedagogical to have something half good, if and only if, “guix lint”
> reports the half bad.  And add an explanation.  WDYT?

I don't know what would be best from a pedagogical perspective: showing
the right code directly (showing more non-trivial things and not
showing any bugs, but possibly showing too much at once), or writing
the half-right code (with a short comment telling there's a bug that
will be explained later).

The second thing doesn't seem bad to me, but IANAP (I am not a
pedagogue).

Greetings,
Maxime
?