guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#76428] [GCD deliberation] Set search paths without program wrappers


From: Janneke Nieuwenhuizen
Subject: [bug#76428] [GCD deliberation] Set search paths without program wrappers
Date: Sun, 23 Mar 2025 12:05:46 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hello,

> # Detailed Design

[..]

> ## Find the location of the current executable
>
> To find its search path configuration files when an executable is running,
> we can first find the location of the executable.  Conveniently, Linux
> provides a pseudo-file `/proc/self/exe` for this exact purpose, which works
> well for ELF executables.   But for an interpreter script, `/proc/self/exe`
> would return the file name of its interpreter instead of the script, so
> we patch interpreters to set 2 environment variables:
>
>   - `GUIX_INTERPRETER_FILE`: absolute file name of the interpreter
>   - `GUIX_MAIN_SCRIPT_FILE`: absolute file name of the script
>
> And when the executable's `/proc/self/exe` matches `GUIX_INTERPRETER_FILE`,
> we can get the script file name from `GUIX_MAIN_SCRIPT_FILE`.  Alternatively,
> we can try to construct the script file name from command line arguments, but
> that won't work when you run a script using a relative file name and its
> current working directory changed before we figure out the script file name.

Would this work with `guix pack' tarball archives, esp. think
cross-built `guix pack' archives for MinGW?

Greetings,
Janneke

-- 
Janneke Nieuwenhuizen <janneke@gnu.org>  | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com





reply via email to

[Prev in Thread] Current Thread [Next in Thread]