Fix user detection if /etc/login.defs does not contain both UID_MIN and UID_MAX (#1014)

## What are the changes about?

I modified getUserIdRange(), so it checks if either of UID_MIN and UID_MAX is set in /etc/login.defs. If any, but not both, is not set, it uses fallback value. I don't know zig build system, so I added ugly fallback values passthrough.

## What existing issue does this resolve?

#1013

## Pre-requisites

- [X] I have tested & confirmed the changes work locally
- [X] I have read and fully adhere to the rules set in the contributing guidelines found in `CONTRIBUTING.md`

Reviewed-on: https://codeberg.org/fairyglade/ly/pulls/1014
Reviewed-by: AnErrupTion <anerruption+codeberg@disroot.org>
This commit is contained in:
Дмитрий
2026-06-12 12:09:37 +02:00
committed by AnErrupTion
parent a07ca88c74
commit 008d413295
4 changed files with 30 additions and 4 deletions

View File

@@ -11,10 +11,15 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
});
const fallback_uid_min = b.option(std.posix.uid_t, "fallback_uid_min", "Set the fallback minimum UID (default is 1000). This value gets embedded into the binary");
const fallback_uid_max = b.option(std.posix.uid_t, "fallback_uid_max", "Set the fallback maximum UID (default is 60000). This value gets embedded into the binary");
const ly_core = b.dependency("ly_core", .{
.target = target,
.optimize = optimize,
.enable_x11_support = enable_x11_support,
.fallback_uid_min = fallback_uid_min,
.fallback_uid_max = fallback_uid_max
});
mod.addImport("ly-core", ly_core.module("ly-core"));