On Wed, Apr 28, 2010 at 02:57:47PM -0400, der Mouse wrote: >>> To wit: as far as I can tell, having been wading around in that code >>> recently, the only problem with what we have is that if the path >>> sent back by namei isn't absolute it needs a getcwd() stuck on the >>> front of it. > >>> Is it reasonable to just do that? > > I don't think so. It would be a regression in that it would break > things in no-path-up-to-/ situations; it also would either fail or > expose paths that shouldn't be accessible in path-to-/-isn't-readable > situations.
Does anyone know how other implementations of $ORIGIN deal with these cases? For the time being, even if we just provide a relative path when getcwd fails it'd still be more functional than the current situation. > > Why not get the kernel to keep a reference to the vnode of the > > directory that contained the process image? > > > Then use some flag to open() (or similar) to open a file relative to > > that vnode? Someone already invented $ORIGIN with absolute paths and we ought to support that, especially since we already have a half-baked implementation. I've often thought something like this (keeping the directory) would be a decent approach but it's not clear how to set it up, or e.g. what ought to be done if the executable is moved or other such cases. > Hacking on namei() just to get an absolute path in $(.MAKE)? It's not just make; see for example PR 42420. -- David A. Holland dholl...@netbsd.org