unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Why bash-minimal is part of sbcl package
@ 2023-12-08 10:34 Pan Xie
  2023-12-10  8:58 ` Guillaume Le Vaillant
  2023-12-12 16:36 ` Maxim Cournoyer
  0 siblings, 2 replies; 5+ messages in thread
From: Pan Xie @ 2023-12-08 10:34 UTC (permalink / raw)
  To: guix-devel, help-guix

Hello

I find this interesting thing but I don't have an explanation. When 
query the "references" of my Gnu Store item "sbcl", it shows that sbcl 
references bash-mininal, as the following output shows:

# guix gc --references /gnu/store/sbbp9nvslqcf3bmcnz5wgxf2qpsi757
/gnu/store/6ncav55lbk5kqvwwflrzcr41hp5jbq0c-gcc-11.3.0-lib
/gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35
/gnu/store/mzx7j93w5szyzrgnql8dqhqdgjh6si02-mpfr-4.2.0
/gnu/store/nl194qnq5lhjxpfwcs15xqihnfqif335-zstd-1.5.2-lib
/gnu/store/sbbp9nvslqcf3bmcnz5wgxf2qpsi757i-sbcl-2.3.7
/gnu/store/v9p25q9l5nnaixkhpap5rnymmwbhf9rp-bash-minimal-5.1.16
/gnu/store/ybadavwz1z9kmxanqy3siw38lnkwnkrp-gmp-6.2.1

However when I look into sbcl's package definition, there is no 
bash-minimal as its input. I can use guix graph find a path from sbcl to 
bash-minimal:

# guix graph --path sbcl bash-minimal
sbcl@2.3.7
texlive-updmap.cfg@66594
texlive-scheme-basic@66594
texlive-collection-basic@66594
texlive-bin@20230313
cairo@1.16.0
bash-minimal@5.1.16

bash-minimal is indeed one of cairo's package input. However cairo also 
has inputs like ghostscript and libspectre, which sbcl does not reference.

"guix size sbcl" also reports bash-minimal is part of sbcl package, and 
"guix pack sbcl" will include bash-minimal in its final tarball.

So the question is, which part of sbcl's package definition tells Guix 
it need to add bash-minimal as part of sbcl? Is there a practical method 
to figure that out?



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

* Re: Why bash-minimal is part of sbcl package
  2023-12-08 10:34 Why bash-minimal is part of sbcl package Pan Xie
@ 2023-12-10  8:58 ` Guillaume Le Vaillant
  2023-12-12 16:36 ` Maxim Cournoyer
  1 sibling, 0 replies; 5+ messages in thread
From: Guillaume Le Vaillant @ 2023-12-10  8:58 UTC (permalink / raw)
  To: Pan Xie; +Cc: guix-devel, help-guix

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

Pan Xie <xiepan@skyguard.com.cn> skribis:

> Hello
>
> I find this interesting thing but I don't have an explanation. When query the
> "references" of my Gnu Store item "sbcl", it shows that sbcl references
> bash-mininal, as the following output shows:
>
> # guix gc --references /gnu/store/sbbp9nvslqcf3bmcnz5wgxf2qpsi757
> /gnu/store/6ncav55lbk5kqvwwflrzcr41hp5jbq0c-gcc-11.3.0-lib
> /gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35
> /gnu/store/mzx7j93w5szyzrgnql8dqhqdgjh6si02-mpfr-4.2.0
> /gnu/store/nl194qnq5lhjxpfwcs15xqihnfqif335-zstd-1.5.2-lib
> /gnu/store/sbbp9nvslqcf3bmcnz5wgxf2qpsi757i-sbcl-2.3.7
> /gnu/store/v9p25q9l5nnaixkhpap5rnymmwbhf9rp-bash-minimal-5.1.16
> /gnu/store/ybadavwz1z9kmxanqy3siw38lnkwnkrp-gmp-6.2.1
>
> However when I look into sbcl's package definition, there is no bash-minimal as
> its input. I can use guix graph find a path from sbcl to bash-minimal:
>
> # guix graph --path sbcl bash-minimal
> sbcl@2.3.7
> texlive-updmap.cfg@66594
> texlive-scheme-basic@66594
> texlive-collection-basic@66594
> texlive-bin@20230313
> cairo@1.16.0
> bash-minimal@5.1.16
>
> bash-minimal is indeed one of cairo's package input. However cairo also has
> inputs like ghostscript and libspectre, which sbcl does not reference.
>
> "guix size sbcl" also reports bash-minimal is part of sbcl package, and "guix
> pack sbcl" will include bash-minimal in its final tarball.
>
> So the question is, which part of sbcl's package definition tells Guix it need
> to add bash-minimal as part of sbcl? Is there a practical method to figure that
> out?

Hi.
It looks like there are some contrib libraries of sbcl that need
a shell, which is why the bash-minimal available in the build
environment is referenced by some files in the sbcl package.
I guess we should list bash-minimal explicitly in the inputs...

--8<---------------cut here---------------start------------->8---
$ grep -R bash-minimal $(guix build sbcl)

grep: /gnu/store/yqqjrhap1jp0aqs5p7xs5j13z0nza1zj-sbcl-2.3.7/lib/sbcl/contrib/sb-executable.fasl: binary file matches
grep: /gnu/store/yqqjrhap1jp0aqs5p7xs5j13z0nza1zj-sbcl-2.3.7/lib/sbcl/contrib/asdf.fasl: binary file matches
grep: /gnu/store/yqqjrhap1jp0aqs5p7xs5j13z0nza1zj-sbcl-2.3.7/lib/sbcl/contrib/sb-aclrepl.fasl: binary file matches
grep: /gnu/store/yqqjrhap1jp0aqs5p7xs5j13z0nza1zj-sbcl-2.3.7/lib/sbcl/contrib/uiop.fasl: binary file matches
/gnu/store/yqqjrhap1jp0aqs5p7xs5j13z0nza1zj-sbcl-2.3.7/share/sbcl/contrib/asdf/pull-asdf.sh:#!/gnu/store/v9p25q9l5nnaixkhpap5rnymmwbhf9rp-bash-minimal-5.1.16/bin/sh -e
/gnu/store/yqqjrhap1jp0aqs5p7xs5j13z0nza1zj-sbcl-2.3.7/share/sbcl/contrib/asdf/asdf.lisp:              #+os-unix (string `("/gnu/store/v9p25q9l5nnaixkhpap5rnymmwbhf9rp-bash-minimal-5.1.16/bin/sh" "-c" ,command))
/gnu/store/yqqjrhap1jp0aqs5p7xs5j13z0nza1zj-sbcl-2.3.7/share/sbcl/contrib/asdf/asdf.lisp:                  #+os-unix ,@'(ext:run-program "/gnu/store/v9p25q9l5nnaixkhpap5rnymmwbhf9rp-bash-minimal-5.1.16/bin/sh" :arguments `("-c" ,%command))
/gnu/store/yqqjrhap1jp0aqs5p7xs5j13z0nza1zj-sbcl-2.3.7/share/sbcl/contrib/asdf/uiop.lisp:              #+os-unix (string `("/gnu/store/v9p25q9l5nnaixkhpap5rnymmwbhf9rp-bash-minimal-5.1.16/bin/sh" "-c" ,command))
/gnu/store/yqqjrhap1jp0aqs5p7xs5j13z0nza1zj-sbcl-2.3.7/share/sbcl/contrib/asdf/uiop.lisp:                  #+os-unix ,@'(ext:run-program "/gnu/store/v9p25q9l5nnaixkhpap5rnymmwbhf9rp-bash-minimal-5.1.16/bin/sh" :arguments `("-c" ,%command))
/gnu/store/yqqjrhap1jp0aqs5p7xs5j13z0nza1zj-sbcl-2.3.7/share/sbcl/contrib/sb-aclrepl/repl.lisp:  (sb-ext:run-program "/gnu/store/v9p25q9l5nnaixkhpap5rnymmwbhf9rp-bash-minimal-5.1.16/bin/sh" (list "-c" string-arg)
/gnu/store/yqqjrhap1jp0aqs5p7xs5j13z0nza1zj-sbcl-2.3.7/share/sbcl/contrib/sb-executable/sb-executable.lisp:  "#!/gnu/store/v9p25q9l5nnaixkhpap5rnymmwbhf9rp-bash-minimal-5.1.16/bin/sh --
/gnu/store/yqqjrhap1jp0aqs5p7xs5j13z0nza1zj-sbcl-2.3.7/share/sbcl/contrib/sb-posix/posix-tests.lisp:           (stat-2 (sb-posix:stat "/gnu/store/v9p25q9l5nnaixkhpap5rnymmwbhf9rp-bash-minimal-5.1.16/bin/sh"
--8<---------------cut here---------------end--------------->8---

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

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

* Re: Why bash-minimal is part of sbcl package
  2023-12-08 10:34 Why bash-minimal is part of sbcl package Pan Xie
  2023-12-10  8:58 ` Guillaume Le Vaillant
@ 2023-12-12 16:36 ` Maxim Cournoyer
  2023-12-12 16:51   ` Felix Lechner via
  1 sibling, 1 reply; 5+ messages in thread
From: Maxim Cournoyer @ 2023-12-12 16:36 UTC (permalink / raw)
  To: Pan Xie; +Cc: guix-devel, help-guix

Hi,

Pan Xie <xiepan@skyguard.com.cn> writes:

> Hello
>
> I find this interesting thing but I don't have an explanation. When
> query the "references" of my Gnu Store item "sbcl", it shows that sbcl
> references bash-mininal, as the following output shows:

[...]

> So the question is, which part of sbcl's package definition tells Guix
> it need to add bash-minimal as part of sbcl? Is there a practical
> method to figure that out?

A bunch of core commands such as bash, sed, make etc. are implicitly
included in the build environment by the GNU build systems (which most
other build systems simply extend).

So if there's a bash shebang somewhere, the patch-source-shebang phase
may substitute it to the *native* implicit bash command found in the
environment, thus keeping a reference to it.

That's a bug, as it means bash-minimal should be explicitly added to the
inputs, otherwise when cross-building the package for another
architecture the native bash captured wouldn't be executable on the
target.

-- 
Thanks,
Maxim


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

* Re: Why bash-minimal is part of sbcl package
  2023-12-12 16:36 ` Maxim Cournoyer
@ 2023-12-12 16:51   ` Felix Lechner via
  2023-12-12 20:52     ` Maxim Cournoyer
  0 siblings, 1 reply; 5+ messages in thread
From: Felix Lechner via @ 2023-12-12 16:51 UTC (permalink / raw)
  To: Maxim Cournoyer, Pan Xie; +Cc: guix-devel, help-guix

Hi Maxim,

On Tue, Dec 12 2023, Maxim Cournoyer wrote:

> it means bash-minimal should be explicitly added to the inputs,
> otherwise when cross-building the package for another architecture the
> native bash captured wouldn't be executable on the target.

The core-updates branch has a lot of new 'bash-minimal' additions,
presumably for cross-building. Maybe this is a good opportunity to ask
about something I have been working on.

As part of a broader effort to make development in scripting language
like GNU Guile easier, I rewrote the executable wrapper so that it uses
Guile instead of Bash.  My initial hope was that the Guile wrapper could
use /run/current-system/profile/bin/guile (and thereby avoid an explicit
Bash prerequisite) but it is only available on Guix System.

My Guile wrapper will eventually reach you as part of a proposal to
migrate Guix from the Automake build system to my very own Bespoke,
which is likewise written in Guile. Meanwhile, please let me know if
there is any use for a Guile wrapper (instead of Bash). Thanks!

Kind regards
Felix


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

* Re: Why bash-minimal is part of sbcl package
  2023-12-12 16:51   ` Felix Lechner via
@ 2023-12-12 20:52     ` Maxim Cournoyer
  0 siblings, 0 replies; 5+ messages in thread
From: Maxim Cournoyer @ 2023-12-12 20:52 UTC (permalink / raw)
  To: Felix Lechner; +Cc: Pan Xie, guix-devel, help-guix

Hi Felix,

Felix Lechner <felix.lechner@lease-up.com> writes:

> Hi Maxim,
>
> On Tue, Dec 12 2023, Maxim Cournoyer wrote:
>
>> it means bash-minimal should be explicitly added to the inputs,
>> otherwise when cross-building the package for another architecture the
>> native bash captured wouldn't be executable on the target.
>
> The core-updates branch has a lot of new 'bash-minimal' additions,
> presumably for cross-building. Maybe this is a good opportunity to ask
> about something I have been working on.
>
> As part of a broader effort to make development in scripting language
> like GNU Guile easier, I rewrote the executable wrapper so that it uses
> Guile instead of Bash.  My initial hope was that the Guile wrapper could
> use /run/current-system/profile/bin/guile (and thereby avoid an explicit
> Bash prerequisite) but it is only available on Guix System.

Yes, the problem with that would be portability when using anything but
a Guix System machine.

> My Guile wrapper will eventually reach you as part of a proposal to
> migrate Guix from the Automake build system to my very own Bespoke,
> which is likewise written in Guile. Meanwhile, please let me know if
> there is any use for a Guile wrapper (instead of Bash). Thanks!

Sounds fun!  You may be interested in looking at 'wrap-script', which
already leverages Guile for use in wrappers.

-- 
Thanks,
Maxim


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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-08 10:34 Why bash-minimal is part of sbcl package Pan Xie
2023-12-10  8:58 ` Guillaume Le Vaillant
2023-12-12 16:36 ` Maxim Cournoyer
2023-12-12 16:51   ` Felix Lechner via
2023-12-12 20:52     ` Maxim Cournoyer

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