Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: DISPLAY problem with zsh + fvwm + firejail
On Wed, Jan 01, 2020 at 08:16:34PM -0600, dana wrote:
> On 1 Jan 2020, at 14:58, Dominik Vogt <dominik.vogt@xxxxxx> wrote:
> > I can't firgure out what's going on. For some reason, DISPLAY is
> > set to an empty string between the final execvp() call in firejail
> > and the place that uses the value, and the shell may or may not be
> > involved in this problem. Note that the same occurs if any shell
> > is set explicitly:
>
> I have absolutely no experience with fvwm or firejail, but:
>
> In the first place, i don't understand what your output means when it says
> that DISPLAY=:0 is passed as an argument to execvp(). execvp() doesn't take
> environment variables as arguments.
Not as argument, but it preserves the contents of the "environ"
global variable so that the new executable uses the same
variables.
Is it using something in between, like env
> or sh, to run it? Or is it just worded imprecisely?
> Assuming the latter, could it be that you have some kind of shared file, like
> /etc/environment, that shells on your system are configured to run on
> start-up?
Sure.
> And maybe that's clearing DISPLAY based on other environment
> variables or whatever?
No, the shell does not clear it. The contents of DISPLAY are
overwritten between the final execvp() of firejail (i.e. they're
still there right before the call). But the executed binary gets
an empty value.
> That seems like a silly thing to do, but if you export
> a variable and then it's unset/changed when you check it from within the
> shell, that's the first thing that comes to mind. (Excepting a few special
> variables that the shell uses for itself, obv.)
DISPLAY is of course exported, otherwise *nothing* that ist
started from the window manager would work.
> Does it show the correct value if you just run env instead of zsh?
No, it's also empty. Note that firejail automatically runs the
command from a shell (zsh in this case) if its not explicitly told
otherwise with
$ firejail --shell=none foo
Without hte shell, the value is fine.
> If not, i think that would mean it's not actually exporting it
> the way it's suggesting it is. If so, something running in the
> shell unsetting it seems more likely.
But "exporting" variables is a concept of the shell, right? So an
execvp() in a random program knows nothing about "exporting"
variables - the called executable just inherits the whole
environment(?).
> Anyay, you can run zsh with -x to see what it might be doing before the set
> command. You might also try it with -f (to disable sourcing start-up files)
Okay, found it. I've some decades old code in /etc/zsh/zshenv to
unset the DISPLAY when running on a console. Something about X
being slow on AIX ages ago, can't really remember.
if [ "$TERM" = linux ] ; then
export DISPLAY=
Which kicks in here because the window manager was started from the
console with the value TERM=linux. :-/
Thanks for the hints.
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
Messages sorted by:
Reverse Date,
Date,
Thread,
Author