unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Can I easily install GNU Emacs 27.1.50 via Guix?
@ 2020-12-09 16:46 Jorge P. de Morais Neto
  2020-12-09 20:56 ` Pierre Neidhardt
  2020-12-10 12:27 ` zimoun
  0 siblings, 2 replies; 21+ messages in thread
From: Jorge P. de Morais Neto @ 2020-12-09 16:46 UTC (permalink / raw)
  To: help-guix

Hi.  For GNU Emacs I manually compile the latest code from the emacs-27
branch (and install it with GNU Stow).  That's because I want the latest
features and fixes, but I fear that the master branch could be
unreliable when used together with certain external packages such as
Notmuch.  When there's a pretest version of emacs-28, I intend to switch
to it---before it is stable---but first I'll ask on the Notmuch mailing
list.

The problem with locally compiling Emacs is that it doesn't see
Guix-installed Elisp packages.  I currently get packages from ELPA (GNU,
Org, Melpa and Melpa-Stable) but the last two have ethical problems, so
I would prefer to get my packages via Guix.  I haven't yet studied Guix
packaging, however, so I need an easy solution.  So is it possible and
easy to get Emacs 27.1.50 via Guix?

Regards

-- 
- <https://jorgemorais.gitlab.io/justice-for-rms/>
- If an email of mine arrives at your spam box, please notify me.
- Please adopt free/libre formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z.
- Free/libre software for Replicant, LineageOS and Android: https://f-droid.org
- [[https://www.gnu.org/philosophy/free-sw.html][What is free software?]]


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-09 16:46 Can I easily install GNU Emacs 27.1.50 via Guix? Jorge P. de Morais Neto
@ 2020-12-09 20:56 ` Pierre Neidhardt
  2020-12-10 12:40   ` zimoun
  2020-12-10 12:27 ` zimoun
  1 sibling, 1 reply; 21+ messages in thread
From: Pierre Neidhardt @ 2020-12-09 20:56 UTC (permalink / raw)
  To: Jorge P. de Morais Neto, help-guix

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

Hi Jorge,

You could use "emacs-next" which is fairly recent.
If that's not enough, then you can easily define your own Emacs package
just like emacs-next, but specify which version you want.

From there, all Guix Emacs packages should work out of the box.

Let me know if you need help writing a package!

Cheers!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

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

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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-09 16:46 Can I easily install GNU Emacs 27.1.50 via Guix? Jorge P. de Morais Neto
  2020-12-09 20:56 ` Pierre Neidhardt
@ 2020-12-10 12:27 ` zimoun
  1 sibling, 0 replies; 21+ messages in thread
From: zimoun @ 2020-12-10 12:27 UTC (permalink / raw)
  To: Jorge P. de Morais Neto, help-guix

Hi,

On Wed, 09 Dec 2020 at 13:46, "Jorge P. de Morais Neto" <jorge+list@disroot.org> wrote:
> Hi.  For GNU Emacs I manually compile the latest code from the emacs-27
> branch (and install it with GNU Stow).  That's because I want the latest
> features and fixes, but I fear that the master branch could be
> unreliable when used together with certain external packages such as
> Notmuch.  When there's a pretest version of emacs-28, I intend to switch
> to it---before it is stable---but first I'll ask on the Notmuch mailing
> list.
>
> The problem with locally compiling Emacs is that it doesn't see
> Guix-installed Elisp packages.  I currently get packages from ELPA (GNU,
> Org, Melpa and Melpa-Stable) but the last two have ethical problems, so
> I would prefer to get my packages via Guix.  I haven't yet studied Guix
> packaging, however, so I need an easy solution.  So is it possible and
> easy to get Emacs 27.1.50 via Guix?

The easiest seems to use build transformations [1] and/or write your own
variant.  The package emacs-next provides 28 at exact version/commit
$(guix show emacs-next | recsel -P version) and using a Git checkout, so
you can try:

  guix build emacs-next --with-commit=emacs-next=<commit>

where <commit> is the commit you are interested in.  If it does not work
out-of-the-box, look “guix edit emacs-next” and then use it to adapt for
your use case.

Note that all the Emacs packages are “bytecompiled” with the Emacs 27 VM
provided by the package emacs-minimal (see guix/build-system/emacs.scm),
modulo some corner cases replacing the VM; for instance ’emacs-magit’
with ’emacs-no-x’.

Therefore, there is no guarantee that:

  guix install emacs-next emacs-foo emacs-bar

works.  It is high probable that it works because the Emacs bytecode
does not often change and generally they try hard to keep compatibility.
But who knows. :-)

It is not as easy to re-bytecompiled all the Emacs packages with another
VM because of these very corner cases.  Two work-in-progress attempts:

 - package parameters [2],
 - package-with-explicit-emacs, the story starts here [3], or scroll [4].


1:
<https://guix.gnu.org/manual/devel/en/guix.html#Package-Transformation-Options>
2: <https://yhetil.org/guix/87eeku8trb.fsf@gnu.org>
3: <https://yhetil.org/guix/868scwtt34.fsf@gmail.com>
4 : <http://issues.guix.gnu.org/issue/41732>


Hope that helps,
simon


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-09 20:56 ` Pierre Neidhardt
@ 2020-12-10 12:40   ` zimoun
  2020-12-17 22:54     ` Jorge P. de Morais Neto
  0 siblings, 1 reply; 21+ messages in thread
From: zimoun @ 2020-12-10 12:40 UTC (permalink / raw)
  To: Pierre Neidhardt, Jorge P. de Morais Neto, help-guix

Hi Pierre,

On Wed, 09 Dec 2020 at 21:56, Pierre Neidhardt <mail@ambrevar.xyz> wrote:

> You could use "emacs-next" which is fairly recent.

[...]

> From there, all Guix Emacs packages should work out of the box.

Only should, no guarantee.  See explanations here:

   <https://yhetil.org/guix/867dppj16x.fsf@gmail.com>
   
Cheers,
simon


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-10 12:40   ` zimoun
@ 2020-12-17 22:54     ` Jorge P. de Morais Neto
  2020-12-17 22:59       ` Jorge P. de Morais Neto
  2020-12-18  2:05       ` zimoun
  0 siblings, 2 replies; 21+ messages in thread
From: Jorge P. de Morais Neto @ 2020-12-17 22:54 UTC (permalink / raw)
  To: help-guix

Hi Pierre and Simon!  Thank you both for your tips and encouragement.  I
ended up studying Guix and then I wrote an `emacs-maint' package that
builds from the emacs-27 branch.  I currently use commit
2dbc95063b5ee3d48aceff05f89e63a134df86ed and I intend to refresh it
monthly.  I have however hit two problems:

* GTK+ search path

When I launch Debian's Evince from Guix's emacs-maint, Evince cannot
find my local printer.  Look at the messages when I open Evince in an
Emacs shell and open Evince's print dialog:

--8<---------------cut here---------------start------------->8---
$ evince&
[1] 22463
jorge@jorge--inspiron-5570:~/unison/STJ/repos/usuários_arriscados_AD$ 
(evince:22463): Gtk-WARNING **: 19:41:17.738: Theme parsing error: gtk-keys.css:1:0: Failed to import: Error opening file /gnu/store/gazmlv80882hgkdnfdzl50b4m8xxj1bz-gtk+-3.24.23/share/themes/Emacs/gtk-3.0/gtk-keys.css: Permission denied
! SyncTeX Error : No file?

(evince:22463): Gtk-WARNING **: 19:41:41.121: /gnu/store/gazmlv80882hgkdnfdzl50b4m8xxj1bz-gtk+-3.24.23/lib/gtk-3.0/3.0.0/printbackends/libprintbackend-file.so: cannot open shared object file: Permission denied

(evince:22463): Gtk-WARNING **: 19:41:41.122: /gnu/store/gazmlv80882hgkdnfdzl50b4m8xxj1bz-gtk+-3.24.23/lib/gtk-3.0/3.0.0/printbackends/libprintbackend-file.so: cannot open shared object file: Permission denied

(evince:22463): Gtk-WARNING **: 19:41:41.122: /gnu/store/gazmlv80882hgkdnfdzl50b4m8xxj1bz-gtk+-3.24.23/lib/gtk-3.0/3.0.0/printbackends/libprintbackend-cups.so: cannot open shared object file: Permission denied

(evince:22463): Gtk-WARNING **: 19:41:41.122: /gnu/store/gazmlv80882hgkdnfdzl50b4m8xxj1bz-gtk+-3.24.23/lib/gtk-3.0/3.0.0/printbackends/libprintbackend-cups.so: cannot open shared object file: Permission denied
--8<---------------cut here---------------end--------------->8---

I suppose this is caused by the following environment variable that
exist in Emacs environment:
    GTK_PATH=/gnu/store/gazmlv80882hgkdnfdzl50b4m8xxj1bz-gtk+-3.24.23/lib/gtk-3.0

This error does not occur when I launch Debian's evince from a manually
compiled Emacs 27.1.50.

* Time zone data

In Guix emacs-maint (as well as in Guix emacs), Emacs wrongly evaluates
the following function call:
    (current-time-zone nil "America/Sao_Paulo")
It returns `(0 "America")'.  In a manually compiled 27.1.50 I get the
correct result.

I have tried installing the tzdata Guix package and restarting my
notebook but the error persisted.

Show I report these problems as two bugs?

And here is the package definition:

--8<---------------cut here---------------start------------->8---
(define-module (jorge-packages emacs-maint)
  #:use-module (guix packages)
  #:use-module (guix git-download)
  #:use-module (gnu packages emacs)
  #:use-module (guix utils))

(define-public emacs-maint
  (let ((commit "2dbc95063b5ee3d48aceff05f89e63a134df86ed")
        (revision "1"))
    (package/inherit emacs-next
      (name "emacs-maint")
      (version (git-version "27.1.50" revision commit))
      (source
       (origin
         (inherit (package-source emacs-next))
         (uri (git-reference
               (url "https://git.savannah.gnu.org/git/emacs.git/")
               ;; (url "https://github.com/emacs-mirror/emacs")
               (commit commit)))
         (file-name (git-file-name name version))
         (sha256
          (base32 "1qcak1abd20wikpvmp7xns59xgxh1rnz70p4crpv8vf2dn2zmfk1"))))
      (native-inputs `(,@(package-native-inputs emacs-next)))
      (native-search-paths
       (list (search-path-specification
              (variable "EMACSLOADPATH")
              ;; The versioned entry is for the Emacs' builtin libraries.
              (files (list "share/emacs/site-lisp"
                           (string-append "share/emacs/"
                                          (version-major+minor+point version)
                                          "/lisp"))))
             (search-path-specification
              (variable "INFOPATH")
              (files '("share/info"))))))))
--8<---------------cut here---------------end--------------->8---

Regards
-- 
- <https://jorgemorais.gitlab.io/justice-for-rms/>
- I am Brazilian.  I hope my English is correct and I welcome feedback.
- <https://www.defectivebydesign.org/>
- <https://www.gnu.org/>


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-17 22:54     ` Jorge P. de Morais Neto
@ 2020-12-17 22:59       ` Jorge P. de Morais Neto
  2020-12-18  2:05       ` zimoun
  1 sibling, 0 replies; 21+ messages in thread
From: Jorge P. de Morais Neto @ 2020-12-17 22:59 UTC (permalink / raw)
  To: help-guix

Em [2020-12-17 qui 19:54:18-0300], Jorge P. de Morais Neto escreveu:

> Show I report these problems as two bugs?

I forgot to mention that I have already (quickly) searched the Guix bugs
database and found no preexisting bug report related to either of these
two problems.

Regards

-- 
- <https://jorgemorais.gitlab.io/justice-for-rms/>
- I am Brazilian.  I hope my English is correct and I welcome feedback.
- Free Software Supporter: <https://www.fsf.org/free-software-supporter>
- If an email of mine arrives at your spam box, please notify me.


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-17 22:54     ` Jorge P. de Morais Neto
  2020-12-17 22:59       ` Jorge P. de Morais Neto
@ 2020-12-18  2:05       ` zimoun
  2020-12-18  4:03         ` Carlo Zancanaro
  1 sibling, 1 reply; 21+ messages in thread
From: zimoun @ 2020-12-18  2:05 UTC (permalink / raw)
  To: Jorge P. de Morais Neto, help-guix

Hi,

On Thu, 17 Dec 2020 at 19:54, Jorge P. de Morais Neto <jorge+list@disroot.org> wrote:

> * GTK+ search path
>
> When I launch Debian's Evince from Guix's emacs-maint, Evince cannot
> find my local printer.  Look at the messages when I open Evince in an
> Emacs shell and open Evince's print dialog:

Well, it seems expected, isn’t it?  Debian’s evince (/usr/bin/evince) is
built with a GTK and the Guix’s emacs with another.  Try:

  sudo apt install evince
  guix environment --pure --ad-hoc emacs
  emacs -q -f shell

and type “/usr/bin/evince”.  You should get an error:

--8<---------------cut here---------------start------------->8---
(evince:19226): GLib-GIO-ERROR **: 02:24:21.012: No GSettings schemas are installed on the system
Trace/breakpoint trap
--8<---------------cut here---------------end--------------->8---

Compare with:

  guix environment --pure --ad-hoc emacs evince
  emacs -q -f shell

and type “evince”.


Then I do not have any error when I open the print dialog; but I have no
setup for CUPS on my machine though.



> --8<---------------cut here---------------start------------->8---
> $ evince&
> [1] 22463
> jorge@jorge--inspiron-5570:~/unison/STJ/repos/usuários_arriscados_AD$ 
> (evince:22463): Gtk-WARNING **: 19:41:17.738: Theme parsing error: gtk-keys.css:1:0: Failed to import: Error opening file /gnu/store/gazmlv80882hgkdnfdzl50b4m8xxj1bz-gtk+-3.24.23/share/themes/Emacs/gtk-3.0/gtk-keys.css: Permission denied
> ! SyncTeX Error : No file?

[...]

> (evince:22463): Gtk-WARNING **: 19:41:41.122: /gnu/store/gazmlv80882hgkdnfdzl50b4m8xxj1bz-gtk+-3.24.23/lib/gtk-3.0/3.0.0/printbackends/libprintbackend-cups.so: cannot open shared object file: Permission denied
> --8<---------------cut here---------------end--------------->8---

Once you did “guix build -L path/to/emacs-maint.scm emacs-maint”, what
did you next?  “guix install” so which packages in the profile?  Or
“guix environment” so with or without ’--pure’?  so with which
’--ad-hoc’ packages?

> I suppose this is caused by the following environment variable that
> exist in Emacs environment:
>     GTK_PATH=/gnu/store/gazmlv80882hgkdnfdzl50b4m8xxj1bz-gtk+-3.24.23/lib/gtk-3.0

What do you mean by Emacs environment?

> This error does not occur when I launch Debian's evince from a manually
> compiled Emacs 27.1.50.

It seems expected.

> * Time zone data
>
> In Guix emacs-maint (as well as in Guix emacs), Emacs wrongly evaluates
> the following function call:
>     (current-time-zone nil "America/Sao_Paulo")
> It returns `(0 "America")'.  In a manually compiled 27.1.50 I get the
> correct result.

What do you expect to have?  This value (-10800 "-03")?  On my machine
“(current-time-zone)” is correct but not “(current-time-zone nil
"Europe/Paris")” which returns “(0 "CET")” instead of “(3600 "CET")”.

Maybe it is a “bug” related to how Guix deals with timestamps because of
reproducibility.  I do not know.


All the best,
simon


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-18  2:05       ` zimoun
@ 2020-12-18  4:03         ` Carlo Zancanaro
  2020-12-18  9:00           ` zimoun
  2020-12-18  9:50           ` Ricardo Wurmus
  0 siblings, 2 replies; 21+ messages in thread
From: Carlo Zancanaro @ 2020-12-18  4:03 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix

Hi Simon,

On Fri, Dec 18 2020, zimoun wrote:
>> When I launch Debian's Evince from Guix's emacs-maint, Evince 
>> cannot find my local printer.  Look at the messages when I open 
>> Evince in an Emacs shell and open Evince's print dialog:
>
> Well, it seems expected, isn’t it? ...

I don't think "expected" is the right way to put this. I think 
"explainable" is more accurate. I think it's reasonable to expect 
that opening Debian's Evince from within Emacs would be able to 
find the printers. The fact that it cannot is a bug introduced by 
Guix's use of environment variables.

I run into a similar problem where my window manager (awesomewm) 
sets LD_LIBRARY_PATH, which then propagates to everything I run 
from my session. It's quite a pain. I thought there was an open 
issue for this, but I can't seem to find it at the moment.

Carlo


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-18  4:03         ` Carlo Zancanaro
@ 2020-12-18  9:00           ` zimoun
  2020-12-18  9:36             ` Carlo Zancanaro
  2020-12-18  9:50           ` Ricardo Wurmus
  1 sibling, 1 reply; 21+ messages in thread
From: zimoun @ 2020-12-18  9:00 UTC (permalink / raw)
  To: Carlo Zancanaro; +Cc: help-guix

Hi,

On Fri, 18 Dec 2020 at 15:03, Carlo Zancanaro <carlo@zancanaro.id.au> wrote:
> On Fri, Dec 18 2020, zimoun wrote:
>>> When I launch Debian's Evince from Guix's emacs-maint, Evince 
>>> cannot find my local printer.  Look at the messages when I open 
>>> Evince in an Emacs shell and open Evince's print dialog:
>>
>> Well, it seems expected, isn’t it? ...
>
> I don't think "expected" is the right way to put this. I think 
> "explainable" is more accurate. I think it's reasonable to expect 
> that opening Debian's Evince from within Emacs would be able to 
> find the printers. The fact that it cannot is a bug introduced by 
> Guix's use of environment variables.

Maybe I miss something and I have not dove into all the details so I
could be totally wrong.  However, from my understanding, A is built
against the shared library C1, and B is built against the shared library
C2, and nothing says that C1 and C2 are compatible.  If you run A inside
B, then C2 is used for both A and B, and A fails because it expects C1
and finds instead C2.  I miss why it is considered as a bug.  Aside the
fact that A and C1 are system-wide so without any control on how it is
built.

From my understanding, it is a bug if A built against C2 run inside B
built too against C2 does not work; which correspond to:

      guix environment --pure --ad-hoc emacs evince
      emacs -q -f shell

    and type “evince”.

    Then I do not have any error when I open the print dialog; but I have no
    setup for CUPS on my machine though.

And it appears to me also a bug if:

  guix environment --pure --ad-hoc emacs-no-x
  emacs -q -f shell

and type “/usr/bin/evince” where the print dialog fails.  On my machine,
it is not the case; but I have no setup for CUPS on my machine though.

Otherwise, from my point of view, failure should happen and I miss why
it should be considered as a bug, but as I said, I should probably miss
something and be wrong.

> I run into a similar problem where my window manager (awesomewm) 
> sets LD_LIBRARY_PATH, which then propagates to everything I run 
> from my session. It's quite a pain. I thought there was an open 
> issue for this, but I can't seem to find it at the moment.

On foreign distro or Guix System?


All the best,
simon


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-18  9:00           ` zimoun
@ 2020-12-18  9:36             ` Carlo Zancanaro
  2020-12-18 10:38               ` zimoun
                                 ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Carlo Zancanaro @ 2020-12-18  9:36 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix

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

Hi Simon,

On Fri, Dec 18 2020, zimoun wrote:
> Maybe I miss something and I have not dove into all the details 
> so I could be totally wrong.  However, from my understanding, A 
> is built against the shared library C1, and B is built against 
> the shared library C2, and nothing says that C1 and C2 are 
> compatible.

This is true if they are in the same address space, but in this 
case evince runs as a separate process. There's no reason it has 
to load the same libraries as emacs, or have the same GTK_PATH 
variable. You should be able to show this by replacing evince with 
a script that unsets GTK_PATH before invoking the system evince. I 
have attached such a wrapper, if you want to add it to your path 
to check on a foreign distribution (it makes the print dialog in 
evince work for me, even when I run evince from within Guix's 
emacs).

One may argue that the system is functioning correctly, and this 
is an unfortunate consequence of the way that Guix works. I would 
still consider the faulty behaviour a bug - even if it is a result 
of intentional decisions made in Guix's design. Running evince 
(i.e. /usr/bin/evince) is failing because of an environment 
variable that Guix's wrapper sets for emacs. That environment 
variable is propagated to child processes (as environment 
variables are), and in this instance that causes the child process 
to misbehave. This is a bug caused by Guix's wrapping of emacs.

>> I run into a similar problem where my window manager 
>> (awesomewm) sets LD_LIBRARY_PATH, which then propagates to 
>> everything I run from my session. It's quite a pain. I thought 
>> there was an open issue for this, but I can't seem to find it 
>> at the moment.
>
> On foreign distro or Guix System?

I am using Guix on a foreign distribution. I imagine a Guix system 
would mask this bug because we wrap lots of programs (using 
wrap-program or similar) so that they explicitly set the 
environment variables they run with, but it may still be possible 
to provoke it Guix built binaries. I haven't tried.

Carlo


[-- Attachment #2: evince --]
[-- Type: application/octet-stream, Size: 46 bytes --]

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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-18  4:03         ` Carlo Zancanaro
  2020-12-18  9:00           ` zimoun
@ 2020-12-18  9:50           ` Ricardo Wurmus
  1 sibling, 0 replies; 21+ messages in thread
From: Ricardo Wurmus @ 2020-12-18  9:50 UTC (permalink / raw)
  To: Carlo Zancanaro; +Cc: help-guix


Carlo Zancanaro <carlo@zancanaro.id.au> writes:

> I run into a similar problem where my window manager (awesomewm) sets
> LD_LIBRARY_PATH, which then propagates to everything I run from my
> session. It's quite a pain. I thought there was an open issue for
> this, but I can't seem to find it at the moment.

gnome-shell from Guix does that too.  I think I introduced this bug when
I upgraded Gnome many months ago; it seemed necessary then but it may no
longer be needed.

We should remove the LD_LIBRARY_PATH from there.  I cannot test this
right now, but if a reconfigured system with this change boots fine and
a user can log in, then there’s no reason to keep the LD_LIBRARY_PATH
wrapping.

-- 
Ricardo


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-18  9:36             ` Carlo Zancanaro
@ 2020-12-18 10:38               ` zimoun
  2020-12-18 11:37                 ` Carlo Zancanaro
  2020-12-18 10:44               ` Dr. Arne Babenhauserheide
  2020-12-18 15:09               ` Jorge P. de Morais Neto
  2 siblings, 1 reply; 21+ messages in thread
From: zimoun @ 2020-12-18 10:38 UTC (permalink / raw)
  To: Carlo Zancanaro; +Cc: help-guix

Hi,

On Fri, 18 Dec 2020 at 20:36, Carlo Zancanaro <carlo@zancanaro.id.au> wrote:

> On Fri, Dec 18 2020, zimoun wrote:
>> Maybe I miss something and I have not dove into all the details 
>> so I could be totally wrong.  However, from my understanding, A 
>> is built against the shared library C1, and B is built against 
>> the shared library C2, and nothing says that C1 and C2 are 
>> compatible.
>
> This is true if they are in the same address space, but in this 
> case evince runs as a separate process. There's no reason it has 
> to load the same libraries as emacs, or have the same GTK_PATH 
> variable. You should be able to show this by replacing evince with 
> a script that unsets GTK_PATH before invoking the system evince. I 
> have attached such a wrapper, if you want to add it to your path 
> to check on a foreign distribution (it makes the print dialog in 
> evince work for me, even when I run evince from within Guix's 
> emacs).

Is your point that:

   guix environment --ad-hoc emacs coreutils diffutils --pure
   env > /tmp/env.xterm
   emacs -q -f shell
   (emacs) env > /tmp/env.emacs
   diff /tmp/env.xterm /tmp/env.emacs

--8<---------------cut here---------------start------------->8---
1a2,3
> TERMCAP=
> INSIDE_EMACS=27.1,comint
7a10
> COLUMNS=115
9c12,13
< TERM=xterm-256color
---
> TERM=dumb
> GTK_PATH=/gnu/store/v3rqcgz6chnmv2sg7lgf4s9kv2xyb5rl-gtk+-3.24.23/lib/gtk-3.0
11c15
< SHLVL=1
---
> SHLVL=2
14c18
< PS1=[env]\n\w/\n\u@\h$ 
---
> XDG_DATA_DIRS=/gnu/store/jqyb550ir6m374sd34qw5970lgj103xw-shared-mime-info-1.15/share:/gnu/store/rxg53s8xwc70lpbpp0bfsx89387ahclb-glib-2.62.6/share:/gnu/store/v3rqcgz6chnmv2sg7lgf4s9kv2xyb5rl-gtk+-3.24.23/share:/gnu/store/929jj5kcwg5c01ksdpml3r1nhlgz9k3b-emacs-27.1/share
--8<---------------cut here---------------end--------------->8---

so GTK_PATH and maybe XDG_DATA_DIRS should not be there?


However, on my machine running Guix on the top of Debian, I get:

--8<---------------cut here---------------start------------->8---
guix environment --ad-hoc emacs grep coreutils --pure
env | grep GTK_PATH
/usr/bin/evince # Works!

emacs -q -f shell
sh-5.0$ env | grep GTK_PATH
GTK_PATH=/gnu/store/v3rqcgz6chnmv2sg7lgf4s9kv2xyb5rl-gtk+-3.24.23/lib/gtk-3.0
sh-5.0$ /usr/bin/evince

(evince:21780): GLib-GIO-ERROR **: 11:24:25.706: No GSettings schemas are installed on the system
Trace/breakpoint trap
sh-5.0$ unset GTK_PATH
sh-5.0$ env | grep GTK_PATH
sh-5.0$ /usr/bin/evince

(evince:25064): GLib-GIO-ERROR **: 11:32:22.826: No GSettings schemas are installed on the system
Trace/breakpoint trap
--8<---------------cut here---------------end--------------->8---

So the story seems more complicated than GTK_PATH. :-)

> One may argue that the system is functioning correctly, and this 
> is an unfortunate consequence of the way that Guix works. I would 
> still consider the faulty behaviour a bug - even if it is a result 
> of intentional decisions made in Guix's design. Running evince 
> (i.e. /usr/bin/evince) is failing because of an environment 
> variable that Guix's wrapper sets for emacs. That environment 
> variable is propagated to child processes (as environment 
> variables are), and in this instance that causes the child process 
> to misbehave. This is a bug caused by Guix's wrapping of emacs.

I have no opinion.  Even if usually, I prefer that by default the child
(M-x shell) inherits from parent.

>>> I run into a similar problem where my window manager 
>>> (awesomewm) sets LD_LIBRARY_PATH, which then propagates to 
>>> everything I run from my session. It's quite a pain. I thought 
>>> there was an open issue for this, but I can't seem to find it 
>>> at the moment.
>>
>> On foreign distro or Guix System?
>
> I am using Guix on a foreign distribution. I imagine a Guix system 
> would mask this bug because we wrap lots of programs (using 
> wrap-program or similar) so that they explicitly set the 
> environment variables they run with, but it may still be possible 
> to provoke it Guix built binaries. I haven't tried.

Thanks for the explanations.


All the best,
simon


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-18  9:36             ` Carlo Zancanaro
  2020-12-18 10:38               ` zimoun
@ 2020-12-18 10:44               ` Dr. Arne Babenhauserheide
  2020-12-18 12:55                 ` Ricardo Wurmus
  2020-12-18 15:09               ` Jorge P. de Morais Neto
  2 siblings, 1 reply; 21+ messages in thread
From: Dr. Arne Babenhauserheide @ 2020-12-18 10:44 UTC (permalink / raw)
  To: Carlo Zancanaro; +Cc: help-guix

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


Carlo Zancanaro <carlo@zancanaro.id.au> writes:
> One may argue that the system is functioning correctly, and this is an
> unfortunate consequence of the way that Guix works. I would still
> consider the faulty behaviour a bug - even if it is a result of
> intentional decisions made in Guix's design. Running evince (i.e.
> /usr/bin/evince) is failing because of an environment variable that
> Guix's wrapper sets for emacs. That environment variable is propagated
> to child processes (as environment variables are), and in this
> instance that causes the child process to misbehave. This is a bug
> caused by Guix's wrapping of emacs.

In practical terms: You would expect Guix to rename the environment
variable and also patch all guix-installed programs so that they use the
renamed variable without affecting any non-Guix-Program?

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein
ohne es zu merken

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

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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-18 10:38               ` zimoun
@ 2020-12-18 11:37                 ` Carlo Zancanaro
  2020-12-18 13:59                   ` zimoun
  0 siblings, 1 reply; 21+ messages in thread
From: Carlo Zancanaro @ 2020-12-18 11:37 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix

Hi Simon,

On Fri, Dec 18 2020, zimoun wrote:
> Is your point that:
>
> ...

My point is: Guix manipulates environment variables in a way that 
can, and does, break "foreign" programs when Guix's programs 
launch "foreign" programs. We should consider this a bug. This bug 
might be hard, or even impossible, to resolve but we should 
consider it a bug nonetheless.

Lots of variables are safe to manipulate, like COLUMNS, or TERM, 
but some are dangerous, like GTK_PATH, XDG_DATA_DIRS, and 
LD_LIBRARY_PATH (among others). This isn't always a problem, but 
sometimes it is.

> However, on my machine running Guix on the top of Debian, I get:
>
> --8<---------------cut 
> here---------------start------------->8---
> guix environment --ad-hoc emacs grep coreutils --pure
> env | grep GTK_PATH
> /usr/bin/evince # Works!
>
> emacs -q -f shell
> sh-5.0$ env | grep GTK_PATH
> GTK_PATH=/gnu/store/v3rqcgz6chnmv2sg7lgf4s9kv2xyb5rl-gtk+-3.24.23/lib/gtk-3.0
> sh-5.0$ /usr/bin/evince
>
> (evince:21780): GLib-GIO-ERROR **: 11:24:25.706: No GSettings 
> schemas are installed on the system
> Trace/breakpoint trap
> sh-5.0$ unset GTK_PATH
> sh-5.0$ env | grep GTK_PATH
> sh-5.0$ /usr/bin/evince
>
> (evince:25064): GLib-GIO-ERROR **: 11:32:22.826: No GSettings 
> schemas are installed on the system
> Trace/breakpoint trap
> --8<---------------cut 
> here---------------end--------------->8---
>
> So the story seems more complicated than GTK_PATH. :-)

Did you try opening the print dialog in evince? If you did, then 
you should have seen different behaviour when GTK_PATH was set 
compared to when it wasn't. Namely, when GTK_PATH was set you 
should have seen some messages like this in your shell:

(evince:31345): Gtk-WARNING **: 22:26:55.204: 
/gnu/store/0vi459fa3b36b5xw8gkxmvfpqz48cyqr-gtk+-3.24.23/lib/gtk-3.0/3.0.0/printbackends/libprintbackend-cups.so: 
cannot open shared object file: Permission denied

The problem is that GTK_PATH is checked for libraries first, where 
it finds the above library and tries and fails to load it. It does 
not fall back to the default paths, but rather treats loading that 
library as having failed, and thus evince cannot print. When 
GTK_PATH is unset it checks the default locations, and 
successfully finds and loads the library, and thus evince can 
print.

Carlo


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-18 10:44               ` Dr. Arne Babenhauserheide
@ 2020-12-18 12:55                 ` Ricardo Wurmus
  2020-12-18 14:05                   ` zimoun
  2020-12-18 15:33                   ` Maxim Cournoyer
  0 siblings, 2 replies; 21+ messages in thread
From: Ricardo Wurmus @ 2020-12-18 12:55 UTC (permalink / raw)
  To: Dr. Arne Babenhauserheide; +Cc: help-guix


Dr. Arne Babenhauserheide <arne_bab@web.de> writes:

> Carlo Zancanaro <carlo@zancanaro.id.au> writes:
>> One may argue that the system is functioning correctly, and this is an
>> unfortunate consequence of the way that Guix works. I would still
>> consider the faulty behaviour a bug - even if it is a result of
>> intentional decisions made in Guix's design. Running evince (i.e.
>> /usr/bin/evince) is failing because of an environment variable that
>> Guix's wrapper sets for emacs. That environment variable is propagated
>> to child processes (as environment variables are), and in this
>> instance that causes the child process to misbehave. This is a bug
>> caused by Guix's wrapping of emacs.
>
> In practical terms: You would expect Guix to rename the environment
> variable and also patch all guix-installed programs so that they use the
> renamed variable without affecting any non-Guix-Program?

Yes.

I agree that the current behaviour is a whole class of bugs that exists
because of confusion between non-Guix binaries and Guix binaries, such
as binary plugins loaded indiscriminately from locations in environment
variables.

It is a difficult but, in my opinion, necessary project, to prefix all
these variables and to patch packages to use the prefixed variables for
augmentation, while also making sense of the unprefixed variables
(e.g. setting PYTHONPATH to make more Python modules available without
having the program use PYTHONPATH by itself).

This is best investigated for each package individually.

The worst offenders in my opinion are the XDG variables and things like
PYTHONPATH, GTK_PATH, etc.

-- 
Ricardo


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-18 11:37                 ` Carlo Zancanaro
@ 2020-12-18 13:59                   ` zimoun
  2020-12-19  0:17                     ` Carlo Zancanaro
  0 siblings, 1 reply; 21+ messages in thread
From: zimoun @ 2020-12-18 13:59 UTC (permalink / raw)
  To: Carlo Zancanaro; +Cc: help-guix

Hi,

On Fri, 18 Dec 2020 at 12:37, Carlo Zancanaro <carlo@zancanaro.id.au> wrote:

> My point is: Guix manipulates environment variables in a way that
> can, and does, break "foreign" programs when Guix's programs
> launch "foreign" programs. We should consider this a bug. This bug
> might be hard, or even impossible, to resolve but we should
> consider it a bug nonetheless.

I am not sure to agree.  The unexpected (by you :-)) behaviour at hand
is about Emacs and "M-x shell"; and I will not speak "in general".

> > --8<---------------cut
> > here---------------start------------->8---
> > guix environment --ad-hoc emacs grep coreutils --pure
> > env | grep GTK_PATH
> > /usr/bin/evince # Works!
> >
> > emacs -q -f shell
> > sh-5.0$ env | grep GTK_PATH
> > GTK_PATH=/gnu/store/v3rqcgz6chnmv2sg7lgf4s9kv2xyb5rl-gtk+-3.24.23/lib/gtk-3.0
> > sh-5.0$ /usr/bin/evince
> >
> > (evince:21780): GLib-GIO-ERROR **: 11:24:25.706: No GSettings
> > schemas are installed on the system
> > Trace/breakpoint trap
> > sh-5.0$ unset GTK_PATH
> > sh-5.0$ env | grep GTK_PATH
> > sh-5.0$ /usr/bin/evince
> >
> > (evince:25064): GLib-GIO-ERROR **: 11:32:22.826: No GSettings
> > schemas are installed on the system
> > Trace/breakpoint trap
> > --8<---------------cut
> > here---------------end--------------->8---
> >
> > So the story seems more complicated than GTK_PATH. :-)
>
> Did you try opening the print dialog in evince? If you did, then

I cannot even open "evince" inside Emacs shell...

> you should have seen different behaviour when GTK_PATH was set
> compared to when it wasn't. Namely, when GTK_PATH was set you

...and whatever if GTK_PATH is set or unset.  That's what my example shows.

> The problem is that GTK_PATH is checked for libraries first, where
> it finds the above library and tries and fails to load it. It does
> not fall back to the default paths, but rather treats loading that
> library as having failed, and thus evince cannot print. When
> GTK_PATH is unset it checks the default locations, and
> successfully finds and loads the library, and thus evince can
> print.

My point is: it is more complicated than only the environment variable GTK_PATH.

Well, if you feel it is a bug, please open a bug report detailing what
is the problem.  Personally, I do miss what it is and what could be
the actionable next step.

All the best,
simon


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-18 12:55                 ` Ricardo Wurmus
@ 2020-12-18 14:05                   ` zimoun
  2020-12-18 15:33                   ` Maxim Cournoyer
  1 sibling, 0 replies; 21+ messages in thread
From: zimoun @ 2020-12-18 14:05 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: help-guix

Hi Ricardo,

On Fri, 18 Dec 2020 at 13:56, Ricardo Wurmus <rekado@elephly.net> wrote:

> It is a difficult but, in my opinion, necessary project, to prefix all
> these variables and to patch packages to use the prefixed variables for
> augmentation, while also making sense of the unprefixed variables
> (e.g. setting PYTHONPATH to make more Python modules available without
> having the program use PYTHONPATH by itself).

It would add complexity and I am not convinced that such complexity is
worth.  Aside corner cases for a small set of packages; or say
packages that are difficult to package and not yet in Guix (for
instance PyTorch).

All the best,
simon


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-18  9:36             ` Carlo Zancanaro
  2020-12-18 10:38               ` zimoun
  2020-12-18 10:44               ` Dr. Arne Babenhauserheide
@ 2020-12-18 15:09               ` Jorge P. de Morais Neto
  2020-12-18 23:17                 ` Carlo Zancanaro
  2 siblings, 1 reply; 21+ messages in thread
From: Jorge P. de Morais Neto @ 2020-12-18 15:09 UTC (permalink / raw)
  To: help-guix

Hi Carlo.

Em [2020-12-18 sex 20:36:11+1100], Carlo Zancanaro escreveu:

> This is true if they are in the same address space, but in this
> case evince runs as a separate process. There's no reason it has
> to load the same libraries as emacs, or have the same GTK_PATH
> variable. You should be able to show this by replacing evince with
> a script that unsets GTK_PATH before invoking the system evince. I
> have attached such a wrapper, if you want to add it to your path
> to check on a foreign distribution (it makes the print dialog in
> evince work for me, even when I run evince from within Guix's
> emacs).

I confirm that, with your wrapper, Debian's Evince (launched from Guix's
Emacs) can find the printers and indeed it can print.  It is a pity
though that this workaround needs writing manual wrappers for every
affected program.

Regards

-- 
- <https://jorgemorais.gitlab.io/justice-for-rms/>
- If an email of mine arrives at your spam box, please notify me.
- Please adopt free/libre formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z.
- Free/libre software for Replicant, LineageOS and Android: https://f-droid.org
- [[https://www.gnu.org/philosophy/free-sw.html][What is free software?]]


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-18 12:55                 ` Ricardo Wurmus
  2020-12-18 14:05                   ` zimoun
@ 2020-12-18 15:33                   ` Maxim Cournoyer
  1 sibling, 0 replies; 21+ messages in thread
From: Maxim Cournoyer @ 2020-12-18 15:33 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: help-guix

Hi,

Ricardo Wurmus <rekado@elephly.net> writes:

> Dr. Arne Babenhauserheide <arne_bab@web.de> writes:
>
>> Carlo Zancanaro <carlo@zancanaro.id.au> writes:
>>> One may argue that the system is functioning correctly, and this is an
>>> unfortunate consequence of the way that Guix works. I would still
>>> consider the faulty behaviour a bug - even if it is a result of
>>> intentional decisions made in Guix's design. Running evince (i.e.
>>> /usr/bin/evince) is failing because of an environment variable that
>>> Guix's wrapper sets for emacs. That environment variable is propagated
>>> to child processes (as environment variables are), and in this
>>> instance that causes the child process to misbehave. This is a bug
>>> caused by Guix's wrapping of emacs.
>>
>> In practical terms: You would expect Guix to rename the environment
>> variable and also patch all guix-installed programs so that they use the
>> renamed variable without affecting any non-Guix-Program?
>
> Yes.
>
> I agree that the current behaviour is a whole class of bugs that exists
> because of confusion between non-Guix binaries and Guix binaries, such
> as binary plugins loaded indiscriminately from locations in environment
> variables.
>
> It is a difficult but, in my opinion, necessary project, to prefix all
> these variables and to patch packages to use the prefixed variables for
> augmentation, while also making sense of the unprefixed variables
> (e.g. setting PYTHONPATH to make more Python modules available without
> having the program use PYTHONPATH by itself).

I have been thinking the same thing.  It'd make sense to prevent
unwanted interactions between Guix and a foreign distribution by
prefixing all the environment variables used by Guix by GUIX_ and
patching the software in Guix to honor those (along with their usual
non-prefixed version).  For example, we'd use GUIX_EMACSLOADPATH instead
of EMACSLOADPATH.

+1.

Maxim


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-18 15:09               ` Jorge P. de Morais Neto
@ 2020-12-18 23:17                 ` Carlo Zancanaro
  0 siblings, 0 replies; 21+ messages in thread
From: Carlo Zancanaro @ 2020-12-18 23:17 UTC (permalink / raw)
  To: Jorge P. de Morais Neto; +Cc: help-guix

Hi Jorge,

On Sat, Dec 19 2020, Jorge P. de Morais Neto wrote:
> It is a pity though that this workaround needs writing manual 
> wrappers for every affected program.

In this particular case, we can actually fix Emacs. When Emacs 
spawns a child process it passes the environment as specified in 
the process-environment variable, so you can clear out the 
unwanted environment variables by running something like this 
during startup:

(setq process-environment
      (seq-remove (lambda (s)
                    (or (string-prefix-p "GTK_PATH=" s)
                        (string-prefix-p "XDG_DATA_DIRS=" s)))
                  process-environment))

That doesn't solve the broader problem in Guix, but it should make 
Emacs in particular work properly.

Carlo


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

* Re: Can I easily install GNU Emacs 27.1.50 via Guix?
  2020-12-18 13:59                   ` zimoun
@ 2020-12-19  0:17                     ` Carlo Zancanaro
  0 siblings, 0 replies; 21+ messages in thread
From: Carlo Zancanaro @ 2020-12-19  0:17 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix

Hi Simon,

On Sat, Dec 19 2020, zimoun wrote:
> I am not sure to agree.  The unexpected (by you :-)) behaviour 
> at hand is about Emacs and "M-x shell"; and I will not speak "in 
> general".

Let's avoid using the word "expected", because that word in this 
context can mean different things. I don't "expect" the behaviour 
when I think about Guix from a user's perspective, but I do 
"expect" the behaviour because I know Guix's implementation 
details.

Instead, let's talk about what behaviour we want.

I want to be able to use programs installed by Guix to launch 
programs installed by a host distribution's package manager, and 
have them function properly. This is not currently the case, 
because of the way Guix uses environment variables to set search 
paths. In this particular thread we have been talking about Emacs, 
but the problem is not limited to Emacs.

Is there an argument for the current behaviour? I'm not aware of 
anyone arguing that we want to break programs installed by a host 
distribution when we launch them from a Guix installed program. 
From my perspective the only argument here is "making it work is 
hard, so we haven't done it". This is a good reason for the 
current state of things, but it is not a reason to avoid calling 
this a bug.

> Well, if you feel it is a bug, please open a bug report 
> detailing what is the problem.  Personally, I do miss what it is 
> and what could be the actionable next step.

Sure. I'll add it to my to-do list.

Carlo


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

end of thread, other threads:[~2020-12-19  0:17 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09 16:46 Can I easily install GNU Emacs 27.1.50 via Guix? Jorge P. de Morais Neto
2020-12-09 20:56 ` Pierre Neidhardt
2020-12-10 12:40   ` zimoun
2020-12-17 22:54     ` Jorge P. de Morais Neto
2020-12-17 22:59       ` Jorge P. de Morais Neto
2020-12-18  2:05       ` zimoun
2020-12-18  4:03         ` Carlo Zancanaro
2020-12-18  9:00           ` zimoun
2020-12-18  9:36             ` Carlo Zancanaro
2020-12-18 10:38               ` zimoun
2020-12-18 11:37                 ` Carlo Zancanaro
2020-12-18 13:59                   ` zimoun
2020-12-19  0:17                     ` Carlo Zancanaro
2020-12-18 10:44               ` Dr. Arne Babenhauserheide
2020-12-18 12:55                 ` Ricardo Wurmus
2020-12-18 14:05                   ` zimoun
2020-12-18 15:33                   ` Maxim Cournoyer
2020-12-18 15:09               ` Jorge P. de Morais Neto
2020-12-18 23:17                 ` Carlo Zancanaro
2020-12-18  9:50           ` Ricardo Wurmus
2020-12-10 12:27 ` zimoun

unofficial mirror of help-guix@gnu.org 

This inbox may be cloned and mirrored by anyone:

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

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-user guix-user/ https://yhetil.org/guix-user \
		help-guix@gnu.org
	public-inbox-index guix-user

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.user
	nntp://news.gmane.io/gmane.comp.gnu.guix.user


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