Current-Users archive

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

Re: /proc/self/exe returning '/' ?



On Tue, Nov 19, 2024 at 10:15:00PM +0100, Thomas Klausner wrote:
> Hi!
> 
> lang/perl5/patches/patch-caretx.c has a patch that claims that
> NetBSD's /proc/self/exe sometimes returns '/'.
> 
> The patch seems to be there since 2008 (then named patch-ah):
> 
> revision 1.9
> date: 2008-01-08 16:19:39 +0100;  author: apb;  state: Exp;  lines: +16 -4;
> NetBSD's /proc/${pid}/exe is sometimes a symlink to "/" instead of to the
> actual program name, so Perl's $^X or $EXECUTABLE_NAME variable was wrong.
> Change a test to detect this case, and fall back to using argv[0].
> 
> Is this still an actual existing problem in NetBSD or should I just
> remove the patch?

I think that was fixed in -current in 2007 (sys/miscfs/procfs/procfs_vnops.c
rev 1.152).

The readlink may still fail, in which case argv[0] should be used (but I guess
that is what common code would do here anyway w/o a patch).

So I'd remove the patch and file a NetBSD PR if it is seen again (and then
we should add an ATF test case).

Martin


Home | Main Index | Thread Index | Old Index