all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / Atom feed
* “guix pack -RR” and ignored environment variables
@ 2021-02-22 15:18 Ricardo Wurmus
  2021-02-22 21:34 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Ricardo Wurmus @ 2021-02-22 15:18 UTC (permalink / raw)
  To: guix-devel

Hi Guix,

today I wanted to offer a pack of Guile Studio, which provides a wrapper
script “guile-studio” that sets EMACSLOADPATH and then spawns Emacs:

--8<---------------cut here---------------start------------->8---
#!/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin/sh
EMACSLOADPATH=/gnu/store/7z33lhy9m8xqgym9w3hj30y1w290c8hn-emacs-27.1/share/emacs/site-lisp:/gnu/store/22qrgczgs13r81vh0assi44g65352jsb-emacs-f-0.20.0/share/emacs/site-lisp:/gnu/store/02wl4g5r2jcw3xa50wlvxrzgnbvfl4j9-emacs-memoize-1.1/share/emacs/site-lisp:/gnu/store/5ypb61cywf1jcxb2p85a85a2m19yvbgd-emacs-all-the-icons-4.0.1/share/emacs/site-lisp:/gnu/store/hf1gv2fn3ksnmswmqs2iqpi6762l3vw8-emacs-all-the-icons-dired-1.0-1.980b774/share/emacs/site-lisp:/gnu/store/253a5n1ss5j7q1bn21nxlm468csmnnys-emacs-dired-sidebar-0.1.0-2.da77919/share/emacs/site-lisp:/gnu/store/kfmh5kngrh2911nlwp5wsrjmpwfj7kj4-emacs-doom-modeline-3.0.0/share/emacs/site-lisp:/gnu/store/khrdrw2b06jnf632l886y0ayk2vb62il-emacs-modus-themes-1.1.1/share/emacs/site-lisp:/gnu/store/p7igyy5yfkc1fvnvx19h2g49f6qaajs5-emacs-geiser-0.12/share/emacs/site-lisp:/gnu/store/zf82m64bp66v3sh0rr4p6c26z996dmix-emacs-company-0.9.13/share/emacs/site-lisp:/gnu/store/syrgm56fbk0722rnr59wpircv9n73r2n-emacs-ivy-0.13.1/share/emacs/site-lisp:/gnu/store/425l8kf2rpk9c418vi8i42mw365b4a18-emacs-flycheck-31-2.9bcf6b6/share/emacs/site-lisp:/gnu/store/5z9jjvcfj8qka4ly8iysyrgvyzksj6ig-emacs-flycheck-guile-0.2/share/emacs/site-lisp:/gnu/store/43bpv64d0a6x8bmqcdp4fsawhmspd5mk-emacs-paren-face-1.0.7/share/emacs/site-lisp:/gnu/store/gpwzl1nsis1s3q48sl8qn0hm4g41qgyz-emacs-dash-2.18.0/share/emacs/site-lisp:/gnu/store/gcw8lz0xvansb4dpfiq9m3kzqx0qc12n-emacs-s-1.12.0/share/emacs/site-lisp:/gnu/store/0iwc19qcn2ylrnpsqrfmg8jsij0q6yz7-emacs-dired-hacks-0.0.1-3.d1a2bda/share/emacs/site-lisp:/gnu/store/1a6aqvylh3qym2n3npp9gbvcfpzyglgg-emacs-shrink-path-0.3.1/share/emacs/site-lisp:/gnu/store/60qfm0v7v3h9bl3x5q6iw1kb1phy0w2z-emacs-hydra-0.15.0/share/emacs/site-lisp:/gnu/store/jvdh3zi4fc28ipk2g1na1i6vfa8xismi-emacs-eimp-1.4.0-1.2e7536f/share/emacs/site-lisp:
exec /gnu/store/7z33lhy9m8xqgym9w3hj30y1w290c8hn-emacs-27.1/bin/emacs -mm --no-site-file --no-site-lisp --no-x-resources --no-init-file --load /gnu/store/z2wix8r2gqs4lwwnq744qpj54051y8cy-guile-studio-0.1.0-1.93622e7/share/guile-studio.el
--8<---------------cut here---------------end--------------->8---

Unfortunately, Emacs fails to find ivy when I launch it from a
relocatable pack in a container (to ensure that the contents of the pack
are sufficient).  Here’s what I did:

    $ guix pack -RR -S /bin=bin glibc-locales guile-studio guile
    $ cp the-pack.tar.gz /tmp/test
    $ cd /tmp/test
    $ xhost +local:
    $ guix environment --container -E ^DISPLAY$ --share=/tmp/.X11-unix --ad-hoc tar gzip bash coreutils
    [env] $ tar xf the-pack.tar.gz
    [env] $ ./bin/guile-studio

I look at the value of “load-path” in Emacs and I don’t see any of the
items that are mentioned on the EMACSLOADPATH environment variable, only
things provided by Emacs itself.  “(getenv "EMACSLOADPATH")’ returns
nil.

Are shell wrappers not working when using the binary wrapper produced by
‘guix pack -RR’?

-- 
Ricardo


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

* Re: “guix pack -RR” and ignored environment variables
  2021-02-22 15:18 “guix pack -RR” and ignored environment variables Ricardo Wurmus
@ 2021-02-22 21:34 ` Ludovic Courtès
  2021-02-24 14:18   ` Ricardo Wurmus
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2021-02-22 21:34 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Hey ho!

Ricardo Wurmus <rekado@elephly.net> skribis:

> today I wanted to offer a pack of Guile Studio, which provides a wrapper
> script “guile-studio” that sets EMACSLOADPATH and then spawns Emacs:
>
> #!/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin/sh
> EMACSLOADPATH=/gnu/store/7z33lhy9m8xqgym9w3hj30y1w290c8hn-emacs-27.1/share/emacs/site-lisp:/gnu/store/22qrgczgs13r81vh0assi44g65352jsb-emacs-f-0.20.0/share/emacs/site-lisp:/gnu/store/02wl4g5r2jcw3xa50wlvxrzgnbvfl4j9-emacs-memoize-1.1/share/emacs/site-lisp:/gnu/store/5ypb61cywf1jcxb2p85a85a2m19yvbgd-emacs-all-the-icons-4.0.1/share/emacs/site-lisp:/gnu/store/hf1gv2fn3ksnmswmqs2iqpi6762l3vw8-emacs-all-the-icons-dired-1.0-1.980b774/share/emacs/site-lisp:/gnu/store/253a5n1ss5j7q1bn21nxlm468csmnnys-emacs-dired-sidebar-0.1.0-2.da77919/share/emacs/site-lisp:/gnu/store/kfmh5kngrh2911nlwp5wsrjmpwfj7kj4-emacs-doom-modeline-3.0.0/share/emacs/site-lisp:/gnu/store/khrdrw2b06jnf632l886y0ayk2vb62il-emacs-modus-themes-1.1.1/share/emacs/site-lisp:/gnu/store/p7igyy5yfkc1fvnvx19h2g49f6qaajs5-emacs-geiser-0.12/share/emacs/site-lisp:/gnu/store/zf82m64bp66v3sh0rr4p6c26z996dmix-emacs-company-0.9.13/share/emacs/site-lisp:/gnu/store/syrgm56fbk0722rnr59wpircv9n73r2n-emacs-ivy-0.13.1/share/emacs/site-lisp:/gnu/store/425l8kf2rpk9c418vi8i42mw365b4a18-emacs-flycheck-31-2.9bcf6b6/share/emacs/site-lisp:/gnu/store/5z9jjvcfj8qka4ly8iysyrgvyzksj6ig-emacs-flycheck-guile-0.2/share/emacs/site-lisp:/gnu/store/43bpv64d0a6x8bmqcdp4fsawhmspd5mk-emacs-paren-face-1.0.7/share/emacs/site-lisp:/gnu/store/gpwzl1nsis1s3q48sl8qn0hm4g41qgyz-emacs-dash-2.18.0/share/emacs/site-lisp:/gnu/store/gcw8lz0xvansb4dpfiq9m3kzqx0qc12n-emacs-s-1.12.0/share/emacs/site-lisp:/gnu/store/0iwc19qcn2ylrnpsqrfmg8jsij0q6yz7-emacs-dired-hacks-0.0.1-3.d1a2bda/share/emacs/site-lisp:/gnu/store/1a6aqvylh3qym2n3npp9gbvcfpzyglgg-emacs-shrink-path-0.3.1/share/emacs/site-lisp:/gnu/store/60qfm0v7v3h9bl3x5q6iw1kb1phy0w2z-emacs-hydra-0.15.0/share/emacs/site-lisp:/gnu/store/jvdh3zi4fc28ipk2g1na1i6vfa8xismi-emacs-eimp-1.4.0-1.2e7536f/share/emacs/site-lisp:
> exec /gnu/store/7z33lhy9m8xqgym9w3hj30y1w290c8hn-emacs-27.1/bin/emacs -mm --no-site-file --no-site-lisp --no-x-resources --no-init-file --load /gnu/store/z2wix8r2gqs4lwwnq744qpj54051y8cy-guile-studio-0.1.0-1.93622e7/share/guile-studio.el
>
> Unfortunately, Emacs fails to find ivy when I launch it from a
> relocatable pack in a container (to ensure that the contents of the pack
> are sufficient).  Here’s what I did:
>
>     $ guix pack -RR -S /bin=bin glibc-locales guile-studio guile
>     $ cp the-pack.tar.gz /tmp/test
>     $ cd /tmp/test
>     $ xhost +local:
>     $ guix environment --container -E ^DISPLAY$ --share=/tmp/.X11-unix --ad-hoc tar gzip bash coreutils
>     [env] $ tar xf the-pack.tar.gz
>     [env] $ ./bin/guile-studio
>
> I look at the value of “load-path” in Emacs and I don’t see any of the
> items that are mentioned on the EMACSLOADPATH environment variable, only
> things provided by Emacs itself.  “(getenv "EMACSLOADPATH")’ returns
> nil.
>
> Are shell wrappers not working when using the binary wrapper produced by
> ‘guix pack -RR’?

Hmm I did this test:

--8<---------------cut here---------------start------------->8---
$ guix pack -RR grep -S /bin=bin
/gnu/store/ghi97dm2wap95vhzm03m7rfff4fmd9rh-tarball-pack.tar.gz
--8<---------------cut here---------------end--------------->8---

and then:

--8<---------------cut here---------------start------------->8---
$ unshare -mrf
# cd /tmp
# mkdir pack
# cd pack
# tar xf /gnu/store/ghi97dm2wap95vhzm03m7rfff4fmd9rh-tarball-pack.tar.gz
# mount -t tmpfs none /gnu/store
# ./bin/egrep --version
grep (GNU grep) 3.4
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others; see
<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
# echo /gnu/store/*
/gnu/store/*
--8<---------------cut here---------------end--------------->8---

where ‘egrep’ is a script.  So it looks alright.

My guess is that the container you created contains some store items,
such as the bash that appears in shebang.  Relocatable wrappers don’t do
the namespace/proot/fakechroot dance when the original binary in the
store exists, and instead they executed it directly.  But in your case,
since you have an incomplete store, you’re maybe running bash from the
store (thus without store mappings), and somehow things go wrong
somewhere down the road?…

Thanks,
Ludo’.


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

* Re: “guix pack -RR” and ignored environment variables
  2021-02-22 21:34 ` Ludovic Courtès
@ 2021-02-24 14:18   ` Ricardo Wurmus
  0 siblings, 0 replies; 3+ messages in thread
From: Ricardo Wurmus @ 2021-02-24 14:18 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


Hi,

Ludovic Courtès <ludo@gnu.org> writes:

> $ unshare -mrf

Indeed, with this command instead of “guix environment --container”
everything works as expected.

Thanks!

> My guess is that the container you created contains some store items,
> such as the bash that appears in shebang.  Relocatable wrappers don’t do
> the namespace/proot/fakechroot dance when the original binary in the
> store exists, and instead they executed it directly.  But in your case,
> since you have an incomplete store, you’re maybe running bash from the
> store (thus without store mappings), and somehow things go wrong
> somewhere down the road?…

This seems to be the case.  It’s probably not a big deal, but I do
wonder if we could make packs work just as well on Guix System as on any
other system.  It’s not really that important because Guix System has
Guix and thus no real need for deployment with “guix pack”, but still…

-- 
Ricardo


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

end of thread, other threads:[~2021-02-24 14:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-22 15:18 “guix pack -RR” and ignored environment variables Ricardo Wurmus
2021-02-22 21:34 ` Ludovic Courtès
2021-02-24 14:18   ` Ricardo Wurmus

all messages for Guix-related lists mirrored at yhetil.org

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix

Example config snippet for mirrors.


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git