fix(build): add osusergo tag to prevent SIGFPE crash under systemd

When running Vikunja as a systemd service without HOME set, the AWS SDK's
init() function calls os/user.Current() which uses CGO's getpwuid_r().
This can cause a SIGFPE crash in certain restricted environments.

Adding the osusergo build tag forces Go to use its pure implementation
that parses /etc/passwd directly, avoiding the problematic CGO call.

Fixes #2170
This commit is contained in:
kolaente
2026-02-05 23:29:44 +01:00
parent 1ddb4f1438
commit a1d5b634b9

View File

@@ -211,7 +211,11 @@ func init() {
// Some variables have external dependencies (like git) which may not always be available.
func initVars() {
Tags = os.Getenv("TAGS")
// Always include osusergo to use pure Go os/user implementation instead of CGO.
// This prevents SIGFPE crashes when running under systemd without HOME set,
// caused by glibc's getpwuid_r() failing in certain environments.
// See: https://github.com/go-vikunja/vikunja/issues/2170
Tags = "osusergo " + os.Getenv("TAGS")
setVersion()
setBinLocation()
setPkgVersion()