[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Feature suggestion: env --nopath
From: |
Simon Tatham |
Subject: |
Re: Feature suggestion: env --nopath |
Date: |
Sat, 23 Nov 2024 16:23:54 +0000 |
User-agent: |
Sup/git |
Pádraig Brady <P@draigBrady.com> wrote:
> All these boil down to you want to pass the actual path
> rather than lookup a name in $PATH.
> This can be achieved simply with: env $(realpath -ms "$path")
True – and that's what build systems wrapping 'make' often do (perhaps
in-process or at makefile-construction time), to get round the problem
with $< in VPATH builds.
But that involves a race condition, plus easy-to-get-wrong quoting
issues. In your own example you made a mistake: it should have been
env "$(realpath -ms "$path")", against the possibility that the returned
pathname has a space in it.
The execv strategy needs fewer additional "work properly" wrinkles, and
still works in scenarios where the race condition has serious
implications (maybe something on a security boundary). I'd like to see a
world where the realpath bodge isn't necessary any more.
Cheers,
Simon
--
for k in [pow(x,37,0x1a1298d262b49c895d47f) for x in [0x50deb914257022de7fff,
0x213558f2215127d5a2d1, 0x90c99e86d08b91218630, 0x109f3d0cfbf640c0beee7,
0xc83e01379a5fbec5fdd1, 0x19d3d70a8d567e388600e, 0x534e2f6e8a4a33155123]]:
print("".join([chr(32+3*((k>>x)&1))for x in range(79)])) # <anakin@pobox.com>