-
-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(niri-session)!: no longer import all environment variables into dbus/systemd #255
base: main
Are you sure you want to change the base?
Conversation
I tried this on my GDM setup and it panics upon starting; presumably, it doesn't know what TTY it's supposed to take over because some environment variable is missing. Actually, this makes me remember another reason for importing all variables: so that variables from the shell .bashrc and all make it into the spawned processes (via niri or systemd itself). I don't think there's any other way of doing this? What does systemd recommend? |
Yeah, I wasn't specific, but the .bashrc variables were what I was thinking of when I mentioned this over in the issue:
When I tested this, I started from greetd as my greeter, I'll make sure to also test with GDM when I revisit this I don't know if it's recommended, but what I've been doing with my own shell setup (for probably years now) is to e.g. set PATH and then explicitly |
I have a concrete use-case: right now on Fedora they set |
Hmmm, anything in the user's default SHELL (or So, it's only processes activated by D-Bus or systemd that would miss out (I imagine there is a smaller number of these compared to those launched as To prevent regressions for those processes, we can come up with a list of variables, or we can decline this PR :) |
How? Right now the way it ends up there, is by the blanket import-environment, as far as I can tell. Because niri is started as a systemd service also, so it just uses that global environment. Perhaps in your case something else is doing a blanket import-environment earlier, so you have it filled in? |
Bah, I totally forgot about Yep, I'm onboard, it's a problem :) |
FWIW I imagine the gnome session has the same issue to deal with? Have they come up with anything to this end yet? I'm pretty sure a few years ago they tried avoiding the shell in the session startup, then ran into the same problem that users expect shell variables to be set. |
Ah, yes, I went all-in on systemd a while back and have a bunch of user environment generators: https://gitlab.com/jokeyrhyme/dotfiles/-/tree/main/etc/systemd/user-environment-generators Which explains why the SHELL setup on my machine is so inconsequential, as intended and then later forgotten by me :) |
Okay, thinking about this a bit more, abandoning this is still an option (we don't know when upstream's deprecation will become a hard-removal, if ever): won't break compatibility with existing setups Or we can change the approach to not launch Or we can change Or we can hardcode a list of environment variables that we pass to There are probably other solutions, I'm just trying to put together the list while I mull it over :) |
Yeah, I think having a systemd service is good and has a lot of benefits. Another example is you can do
That kinda sounds just like reinventing a blanket import-environment but more complex and less brittle, plus systemd-activated programs won't get the environment variables, which is undesirable.
Yeah that's just asking for trouble or endless maintenance.
Yeah I guess let's just not worry about it for now, then see what others do like GNOME. Maybe some solution will emerge. |
fixes #254
I did some testing and can confirm that the contents of my environment variables and those in my user service manager were as expected on my machine
But note that I'm not yet using niri as my primary desktop, so it's possible/probable that my testing doesn't cover something someone else would notice and miss dearly