GNU bug report logs - #32749
package-with-explicit-inputs leaks-in additional inputs

Previous Next

Package: guix;

Reported by: Jan Nieuwenhuizen <janneke <at> gnu.org>

Date: Mon, 17 Sep 2018 10:04:01 UTC

Severity: normal

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32749 in the body.
You can then email your comments to 32749 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#32749; Package guix. (Mon, 17 Sep 2018 10:04:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jan Nieuwenhuizen <janneke <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 17 Sep 2018 10:04:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jan Nieuwenhuizen <janneke <at> gnu.org>
To: bug-guix <at> gnu.org
Subject: package-with-explicit-inputs leaks-in additional inputs
Date: Mon, 17 Sep 2018 12:03:10 +0200
[Message part 1 (text/plain, inline)]
Hi!

Rewriting the bootstrap on the wip-bootstrap branch I found additional
inputs in packages that use `package-with-explicit-inputs', such as
diffutils-boot0.

I would expect diffutils-boot0 to list just one extra input in addition
to gnu-make-boot0; namely the package gnu-make-boot0; however it has
many more.

To reproduce this I created a test file with two simple packages
gnu-make-explicit-inputs, gnu-make-no-implicit-inputs.

Put the attached file in gnu/packages and producing a graph for both
test packages

--8<---------------cut here---------------start------------->8---
11:56:03 janneke <at> dundal:~/src/guix-master 
$ ./pre-inst-env guix graph --type=bag -e '(begin (use-modules (guix packages)) (@@ (gnu packages pawei) gnu-make-no-implicit-inputs))' | wc -l
14
11:56:22 janneke <at> dundal:~/src/guix-master 
$ ./pre-inst-env guix graph --type=bag -e '(begin (use-modules (guix packages)) (@@ (gnu packages pawei) gnu-make-explicit-inputs))' | wc -l
79
--8<---------------cut here---------------end--------------->8---

Should `package-with-explicit-inputs' behave like I think it does, i.e.,
should both test packages list the same dependencies, or am I missing
something?

[pawei.scm (application/octet-stream, attachment)]
[make-no-implicit-inputs.dot (application/octet-stream, attachment)]
[make-explicit-inputs.dot (application/octet-stream, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#32749; Package guix. (Mon, 17 Sep 2018 16:01:02 GMT) Full text and rfc822 format available.

Message #8 received at 32749 <at> debbugs.gnu.org (full text, mbox):

From: Jan Nieuwenhuizen <janneke <at> gnu.org>
To: 32749 <at> debbugs.gnu.org
Subject: Re: bug#32749: package-with-explicit-inputs leaks-in additional inputs
Date: Mon, 17 Sep 2018 17:59:54 +0200
Jan Nieuwenhuizen writes:

> Should `package-with-explicit-inputs' behave like I think it does, i.e.,
> should both test packages list the same dependencies, or am I missing
> something?

Printing the packages in the Guix Repl gives this result

--8<---------------cut here---------------start------------->8---
(package-inputs gnu-make-no-implicit-inputs)
$12 = (("libc" #<package glibc-bootstrap <at> 0 gnu/packages/bootstrap.scm:150 3f39cc0>) ("gcc" #<package gcc-bootstrap <at> 0 gnu/packages/bootstrap.scm:150 3f39c00>) ("binutils" #<package binutils-bootstrap <at> 0 gnu/packages/bootstrap.scm:150 3f39b40>) ("coreutils&co" #<package bootstrap-binaries <at> 0 gnu/packages/bootstrap.scm:150 3f39a80>) ("bash" #<package bootstrap-binaries <at> 0 gnu/packages/bootstrap.scm:150 3f39a80>))
scheme@(gnu packages pawei)> (map car (package-inputs gnu-make-no-implicit-inputs))
$13 = ("libc" "gcc" "binutils" "coreutils&co" "bash")
scheme@(gnu packages pawei)> (package-native-inputs gnu-make-no-implicit-inputs)
$14 = ()
scheme@(gnu packages pawei)> (package-propagated-inputs gnu-make-no-implicit-inputs)
$15 = ()
scheme@(gnu packages pawei)> (package-inputs gnu-make-explicit-inputs)
$16 = (("libc" #<package glibc-bootstrap <at> 0 gnu/packages/bootstrap.scm:150 3f39cc0>) ("gcc" #<package gcc-bootstrap <at> 0 gnu/packages/bootstrap.scm:150 3f39c00>) ("binutils" #<package binutils-bootstrap <at> 0 gnu/packages/bootstrap.scm:150 3f39b40>) ("coreutils&co" #<package bootstrap-binaries <at> 0 gnu/packages/bootstrap.scm:150 3f39a80>) ("bash" #<package bootstrap-binaries <at> 0 gnu/packages/bootstrap.scm:150 3f39a80>) ("guile" #<package guile <at> 2.0.14 gnu/packages/bootstrap.scm:150 3f39900>))
scheme@(gnu packages pawei)> 
$17 = (("pkg-config" #<package pkg-config <at> 0.29.2 gnu/packages/bootstrap.scm:150 3f39780>))
scheme@(gnu packages pawei)> (package-propagated-inputs gnu-make-explicit-inputs)
$18 = ()
scheme@(gnu packages pawei)> (package-native-inputs gnu-make-explicit-inputs)
$19 = (("pkg-config" #<package pkg-config <at> 0.29.2 gnu/packages/bootstrap.scm:150 3f39780>))
--8<---------------cut here---------------end--------------->8---

which is exactly what I expect to see when I read the Guile code for the
package descriptions; but is still a bit surprising to me: where do all
the extra inputs come from in the graph?

janneke




Information forwarded to bug-guix <at> gnu.org:
bug#32749; Package guix. (Mon, 17 Sep 2018 20:28:01 GMT) Full text and rfc822 format available.

Message #11 received at 32749 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Jan Nieuwenhuizen <janneke <at> gnu.org>
Cc: 32749 <at> debbugs.gnu.org
Subject: Re: bug#32749: package-with-explicit-inputs leaks-in additional inputs
Date: Mon, 17 Sep 2018 22:26:51 +0200
Hello!

Jan Nieuwenhuizen <janneke <at> gnu.org> skribis:

> 11:56:03 janneke <at> dundal:~/src/guix-master 
> $ ./pre-inst-env guix graph --type=bag -e '(begin (use-modules (guix packages)) (@@ (gnu packages pawei) gnu-make-no-implicit-inputs))' | wc -l
> 14
> 11:56:22 janneke <at> dundal:~/src/guix-master 
> $ ./pre-inst-env guix graph --type=bag -e '(begin (use-modules (guix packages)) (@@ (gnu packages pawei) gnu-make-explicit-inputs))' | wc -l
> 79

[...]

> (define gnu-make-no-implicit-inputs
>   (package-with-bootstrap-guile
>    (package (inherit gnu-make)
>             (name "make-no-implicit-inputs")
>             (inputs (%bootstrap-inputs+toolchain))
>             (native-inputs '())
>             (arguments `(#:guile ,%bootstrap-guile
>                          #:implicit-inputs? #f
>                          ,@(package-arguments diffutils))))))
>
> (define gnu-make-explicit-inputs
>   (let ((p (package-with-explicit-inputs gnu-make
>                                          (%bootstrap-inputs+toolchain)
>                                          #:guile %bootstrap-guile)))
>     (package-with-bootstrap-guile
>      (package (inherit p)
>               (name "make-explicit-inputs")
>               (arguments (package-arguments p))))))

The difference comes from the fact that ‘gnu-make-explicit-inputs’ has
Guile in its ‘inputs’:

--8<---------------cut here---------------start------------->8---
scheme@(gnu packages pawei)> (package-direct-inputs gnu-make-explicit-inputs)
$5 = (("libc" #<package glibc-bootstrap <at> 0 gnu/packages/bootstrap.scm:150 3d216c0>) ("gcc" #<package gcc-bootstrap <at> 0 gnu/packages/bootstrap.scm:150 3d21600>) ("binutils" #<package binutils-bootstrap <at> 0 gnu/packages/bootstrap.scm:150 3d21540>) ("coreutils&co" #<package bootstrap-binaries <at> 0 gnu/packages/bootstrap.scm:150 3d21480>) ("bash" #<package bootstrap-binaries <at> 0 gnu/packages/bootstrap.scm:150 3d21480>) ("guile" #<package guile <at> 2.0.14 gnu/packages/bootstrap.scm:150 3d213c0>))
--8<---------------cut here---------------end--------------->8---

This comes from the fact that the ‘inputs’ field is not overridden,
unlike in the case of ‘gnu-make-no-implicit-inputs’.

To solve this, the solution is to add this one ‘inputs’ line:

--8<---------------cut here---------------start------------->8---
(define gnu-make-explicit-inputs
  (let ((p (package-with-explicit-inputs gnu-make
                                         (%bootstrap-inputs+toolchain)
                                         #:guile %bootstrap-guile)))
    (package-with-bootstrap-guile
     (package (inherit p)
              (name "make-explicit-inputs")
              (inputs '())                        ;<- HERE
              (arguments (package-arguments p))))))
--8<---------------cut here---------------end--------------->8---

Perhaps you hit similar cases on ‘wip-bootstrap’?  It’s easy to leave
out too many inputs…

Cheers,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#32749; Package guix. (Tue, 18 Sep 2018 04:25:02 GMT) Full text and rfc822 format available.

Message #14 received at 32749 <at> debbugs.gnu.org (full text, mbox):

From: Jan Nieuwenhuizen <janneke <at> gnu.org>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 32749 <at> debbugs.gnu.org
Subject: Re: bug#32749: package-with-explicit-inputs leaks-in additional inputs
Date: Tue, 18 Sep 2018 06:23:44 +0200
Ludovic Courtès writes:

> The difference comes from the fact that ‘gnu-make-explicit-inputs’ has
> Guile in its ‘inputs’:

Ah, I missed that!

> scheme@(gnu packages pawei)> (package-direct-inputs gnu-make-explicit-inputs)
> $5 = (("libc" #<package glibc-bootstrap <at> 0 gnu/packages/bootstrap.scm:150 3d216c0>) ("gcc" #<package gcc-bootstrap <at> 0 gnu/packages/bootstrap.scm:150 3d21600>) ("binutils" #<package binutils-bootstrap <at> 0 gnu/packages/bootstrap.scm:150 3d21540>) ("coreutils&co" #<package bootstrap-binaries <at> 0 gnu/packages/bootstrap.scm:150 3d21480>) ("bash" #<package bootstrap-binaries <at> 0 gnu/packages/bootstrap.scm:150 3d21480>) ("guile" #<package guile <at> 2.0.14 gnu/packages/bootstrap.scm:150 3d213c0>))
>
> This comes from the fact that the ‘inputs’ field is not overridden,
> unlike in the case of ‘gnu-make-no-implicit-inputs’.
>
> To solve this, the solution is to add this one ‘inputs’ line:
>
> (define gnu-make-explicit-inputs
>   (let ((p (package-with-explicit-inputs gnu-make
>                                          (%bootstrap-inputs+toolchain)
>                                          #:guile %bootstrap-guile)))
>     (package-with-bootstrap-guile
>      (package (inherit p)
>               (name "make-explicit-inputs")
>               (inputs '())                        ;<- HERE
>               (arguments (package-arguments p))))))
>
> Perhaps you hit similar cases on ‘wip-bootstrap’?  It’s easy to leave
> out too many inputs…

I tried this!  The dependencies look OK, but the package won't build --
there's no tar, make etc.

That can be fixed by repeating the explicit inputs, like this:

--8<---------------cut here---------------start------------->8---
(define gnu-make-explicit-inputs
  (let ((p (package-with-explicit-inputs gnu-make
                                         (%bootstrap-inputs+toolchain)
                                         #:guile %bootstrap-guile)))
    (package-with-bootstrap-guile
     (package (inherit p)
              (name "make-explicit-inputs")
              (inputs (%bootstrap-inputs+toolchain))
              (native-inputs '())
              (arguments (package-arguments p))))))
--8<---------------cut here---------------end--------------->8---

...but that looks a bit strange: if we have to mention the inputs a
second time the advantage over using the `gnu-make-no-implicit-inputs'
package description becomes real small?

I also tried

     (inputs (package-inputs p))

but that pulls in gcc-bootstrap-0 again; which lead me to believe
`package-with-explicit-inputs' has no observable effect?

Still a bit puzzled whether to revert the rewrites that removed
`package-with-explicit-inputs' and replace them by this second input
repetition...

janneke




Information forwarded to bug-guix <at> gnu.org:
bug#32749; Package guix. (Tue, 18 Sep 2018 14:39:02 GMT) Full text and rfc822 format available.

Message #17 received at 32749 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Jan Nieuwenhuizen <janneke <at> gnu.org>
Cc: 32749 <at> debbugs.gnu.org
Subject: Re: bug#32749: package-with-explicit-inputs leaks-in additional inputs
Date: Tue, 18 Sep 2018 16:38:01 +0200
Hello,

Jan Nieuwenhuizen <janneke <at> gnu.org> skribis:

> Ludovic Courtès writes:
>
>> The difference comes from the fact that ‘gnu-make-explicit-inputs’ has
>> Guile in its ‘inputs’:
>
> Ah, I missed that!
>
>> scheme@(gnu packages pawei)> (package-direct-inputs gnu-make-explicit-inputs)
>> $5 = (("libc" #<package glibc-bootstrap <at> 0 gnu/packages/bootstrap.scm:150 3d216c0>) ("gcc" #<package gcc-bootstrap <at> 0 gnu/packages/bootstrap.scm:150 3d21600>) ("binutils" #<package binutils-bootstrap <at> 0 gnu/packages/bootstrap.scm:150 3d21540>) ("coreutils&co" #<package bootstrap-binaries <at> 0 gnu/packages/bootstrap.scm:150 3d21480>) ("bash" #<package bootstrap-binaries <at> 0 gnu/packages/bootstrap.scm:150 3d21480>) ("guile" #<package guile <at> 2.0.14 gnu/packages/bootstrap.scm:150 3d213c0>))
>>
>> This comes from the fact that the ‘inputs’ field is not overridden,
>> unlike in the case of ‘gnu-make-no-implicit-inputs’.
>>
>> To solve this, the solution is to add this one ‘inputs’ line:
>>
>> (define gnu-make-explicit-inputs
>>   (let ((p (package-with-explicit-inputs gnu-make
>>                                          (%bootstrap-inputs+toolchain)
>>                                          #:guile %bootstrap-guile)))
>>     (package-with-bootstrap-guile
>>      (package (inherit p)
>>               (name "make-explicit-inputs")
>>               (inputs '())                        ;<- HERE
>>               (arguments (package-arguments p))))))
>>
>> Perhaps you hit similar cases on ‘wip-bootstrap’?  It’s easy to leave
>> out too many inputs…
>
> I tried this!  The dependencies look OK, but the package won't build --
> there's no tar, make etc.

Ah, true!

> That can be fixed by repeating the explicit inputs, like this:
>
> (define gnu-make-explicit-inputs
>   (let ((p (package-with-explicit-inputs gnu-make
>                                          (%bootstrap-inputs+toolchain)
>                                          #:guile %bootstrap-guile)))
>     (package-with-bootstrap-guile
>      (package (inherit p)
>               (name "make-explicit-inputs")
>               (inputs (%bootstrap-inputs+toolchain))
>               (native-inputs '())
>               (arguments (package-arguments p))))))
>
> ...but that looks a bit strange: if we have to mention the inputs a
> second time the advantage over using the `gnu-make-no-implicit-inputs'
> package description becomes real small?

The key thing is that ‘package-with-explicit-inputs’ works recursively:
it adds (it does *not* replace) inputs to the whole package graph.

> I also tried
>
>      (inputs (package-inputs p))
>
> but that pulls in gcc-bootstrap-0 again; which lead me to believe
> `package-with-explicit-inputs' has no observable effect?

Consider this:

  (define x
    (let ((p (package-with-explicit-inputs gnu-make
                                           (%bootstrap-inputs+toolchain)
                                           …)))
      …))

Here ‘%bootstrap-inputs+toolchain’ is called from the top level, when
‘%current-system’ has its default value.  So if you’re on x86_64, you
get the x86_64 inputs.

So it’s not a bug per se, but it’s definitely an annoyance.

I just realized that there’s already a fix for this, which is to pass
‘package-with-explicit-inputs’ a procedure rather than the input list,
like this:

  (package-with-explicit-inputs gnu-make
                                %bootstrap-inputs+toolchain
                                …)

Does it work for you?

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#32749; Package guix. (Tue, 18 Sep 2018 15:05:02 GMT) Full text and rfc822 format available.

Message #20 received at 32749 <at> debbugs.gnu.org (full text, mbox):

From: Jan Nieuwenhuizen <janneke <at> gnu.org>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 32749 <at> debbugs.gnu.org
Subject: Re: bug#32749: package-with-explicit-inputs leaks-in additional inputs
Date: Tue, 18 Sep 2018 17:03:36 +0200
Ludovic Courtès writes:

>> I tried this!  The dependencies look OK, but the package won't build --
>> there's no tar, make etc.
>
> Ah, true!
>
>> ...but that looks a bit strange: if we have to mention the inputs a
>> second time the advantage over using the `gnu-make-no-implicit-inputs'
>> package description becomes real small?
>
> The key thing is that ‘package-with-explicit-inputs’ works recursively:
> it adds (it does *not* replace) inputs to the whole package graph.

Ah, cool!

> Consider this:
>
>   (define x
>     (let ((p (package-with-explicit-inputs gnu-make
>                                            (%bootstrap-inputs+toolchain)
>                                            …)))
>       …))
>
> Here ‘%bootstrap-inputs+toolchain’ is called from the top level, when
> ‘%current-system’ has its default value.  So if you’re on x86_64, you
> get the x86_64 inputs.

Doh'!  The let is at toplevel...yeah that makes sense.

> So it’s not a bug per se, but it’s definitely an annoyance.

I agree, indeed it's rather a problem of interaction between
--system/(%current-system).

> I just realized that there’s already a fix for this, which is to pass
> ‘package-with-explicit-inputs’ a procedure rather than the input list,
> like this:
>
>   (package-with-explicit-inputs gnu-make
>                                 %bootstrap-inputs+toolchain
>                                 …)
>
> Does it work for you?

Yes!  I'm reverting my `...leak' commits and create thunks as input of
package-with-explicit-inputs.  Thanks!

janneke




Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Wed, 19 Sep 2018 20:43:02 GMT) Full text and rfc822 format available.

Notification sent to Jan Nieuwenhuizen <janneke <at> gnu.org>:
bug acknowledged by developer. (Wed, 19 Sep 2018 20:43:02 GMT) Full text and rfc822 format available.

Message #25 received at 32749-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Jan Nieuwenhuizen <janneke <at> gnu.org>
Cc: 32749-done <at> debbugs.gnu.org
Subject: Re: bug#32749: package-with-explicit-inputs leaks-in additional inputs
Date: Wed, 19 Sep 2018 22:42:35 +0200
Jan Nieuwenhuizen <janneke <at> gnu.org> skribis:

> Ludovic Courtès writes:

[...]

>> I just realized that there’s already a fix for this, which is to pass
>> ‘package-with-explicit-inputs’ a procedure rather than the input list,
>> like this:
>>
>>   (package-with-explicit-inputs gnu-make
>>                                 %bootstrap-inputs+toolchain
>>                                 …)
>>
>> Does it work for you?
>
> Yes!  I'm reverting my `...leak' commits and create thunks as input of
> package-with-explicit-inputs.  Thanks!

Awesome, thank you!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 18 Oct 2018 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 192 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.