Stuart Henderson <stu@spacehopper.org> wrote:
> On 2026/01/04 13:04, Rafael Sadowski wrote:
> > Since we do not provide KERN_PROC_PATHNAME I picked up robets@'s "hack"
> > form www/chromium/patches/patch-base_base_paths_posix_cc.
> >
> > It certainly won't work in all cases, but it's enough for me in this context.
> > This implementation only makes sense if we don't call it too often.
>
> IME these programs generally *do not want* to know the current location
> of the actual binary if it was moved while running. they want the path
> that it was originally started from, whether or not the binary is
> still available at the same location.
If they want the original path, they should save that string which they have
in userland, once the open() call succeeds.
> so that approach (i.e. look at argv[0], use it directly if it's an
> absolute path, walk PATH if not) does what the software wants. (you can
> avoid the PATH walking in the common case by installing a wrapper script
> in /usr/local/bin, starting the real binary installed elsewhere or under
> a different name with full path).
I agree. The kernel cannot perform the transform. The userland program
needs to remember.
The people who insist upon the kernel happening are not being smart.
No comments:
Post a Comment