Skip to content
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

Applications launched by the SystemMenu do not inherit the user's login profile #4484

Closed
lux01 opened this issue Dec 21, 2020 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@lux01
Copy link

lux01 commented Dec 21, 2020

As a consequence of how the SystemMenu process is launched by SystemServer, the user's login profile is never run. Consequentially any applications launched from the SystemMenu have no environment variables set. Crucially this means that standard environment variables like HOME are not set.

This manifests itself when an application like Snake tries to access the per-user config file. Since the HOME environment variable is not set, LibC attempts to read /etc/passwd to find the home directory which fails because /etc/passwd has not been unveiled. This can be seen from a repeated perror("open /etc/passwd") message in the syslog:

image

The perror call is from the following stack:

0x04b34bb9: [libc.so] setpwent +99 (pwd.cpp:60)
0x04b3523b: [libc.so] getpwuid +21 (pwd.cpp:82)
0x04c03426: [libcore.so] Core::StandardPaths::home_directory() +94 (StandardPaths.cpp:43)
0x04c0368e: [libcore.so] Core::StandardPaths::config_directory() +66 (StandardPaths.cpp:67)
0x04bee36b: [libcore.so] Core::ConfigFile::get_for_app(AK::String const&) +35 (StringView.h:55)
0x051c5da6: [/bin/Snake] SnakeGame::SnakeGame() +1816 (SnakeGame.cpp:45)
0x051c4d09: [/bin/Snake] SnakeGame& GUI::Window::set_main_widget<SnakeGame>() +39 (Atomic.h:158)
0x051c41a8: [/bin/Snake]  +1096 (kmalloc.h:59)
0x051c6ac1: [/bin/Snake] _start +36 (crt0_shared.cpp:50)
@bcoles bcoles added the bug Something isn't working label Dec 22, 2020
bugaevc added a commit to bugaevc/serenity that referenced this issue Dec 26, 2020
bugaevc added a commit to bugaevc/serenity that referenced this issue Dec 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants