fixes: improve login environment handling (#114)

* chore(organization): allow nested header and c files

* feat: add shell login "middleware" & etc:
  * lidm now calls `bash` (or other shells, depends on PACKAGE cfg) in
  login mode as a session wrapper to source most env (can be disabled)
  * this fixes a lot of env problems with all `/etc/profile` and more

Extra:
* implemented a musl compatible version of `execvpe` and now lidm should
  search for PATH everywhere it needs to
* `search_path` now also checks if the found binary is properly
  executable
* lidm now uses `confstr` for a decent PATH default if none is found
* logs are unbuffered for cases where debug logs appear empty (exit
  without handlers moment)

* chore: one-time evaluate certain makefile vars

---------

Co-authored-by: grialion <48643945+grialion@users.noreply.github.com>
This commit is contained in:
2026-02-07 17:12:03 +01:00
committed by GitHub
parent c009c6c31c
commit 0b2d0bdf03
34 changed files with 555 additions and 424 deletions

View File

@@ -4,9 +4,8 @@
#include <sys/types.h>
#include <unistd.h>
#include "desktop_exec.h"
#include "macros.h"
#include "util.h"
#include "util/vec.h"
enum SessionType {
XORG,
@@ -51,18 +50,6 @@ static inline struct session_exec session_exec_desktop(
};
}
static inline int session_exec_exec(struct session_exec* NNULLABLE exec,
char* NULLABLE* NNULLABLE envlist) {
switch (exec->typ) {
case EXEC_SHELL:
return execle(exec->shell, exec->shell, NULL, envlist);
case EXEC_DESKTOP:
return execvpe_desktop(exec->desktop.args, envlist);
default:
__builtin_unreachable();
}
}
struct session {
char* NNULLABLE name;
struct session_exec exec;
@@ -70,5 +57,9 @@ struct session {
};
struct Vector get_avaliable_sessions();
int session_exec_exec(struct session_exec* NNULLABLE exec,
char* NULLABLE* NNULLABLE envp);
int session_exec_login_through_shell(struct session_exec* NNULLABLE exec,
char* NULLABLE* NNULLABLE envp);
#endif