lkml.org 
[lkml]   [2006]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Add a /proc/self/exedir link
> IMO the program must be aware of the get-my-exedir feature, just configuring
> --prefix=/proc/... is aiming for your feet.

I disagree, though /proc/self/exedir may not be the right answer. The
problem with the original proposal is there's no concept of a group
leader to which files are resolved relative to so there is this problem
with child processes.

I sent a mail outlining a scheme that used file descriptor passing to
achieve the same effect but with the needed "inheritance" of the path,
but, vger seems to have munched it! At least I don't see it on the gmane
archives. But the scheme is simple enough:

* get_prefix() reads /proc/self/exe and turns it into the correct
directory

* dup2(open(get_my_exedir()), 999)

* ./configure --prefix=/proc/self/fd/999

Obviously that code leaks but you get the idea. Paths can now be
resolved relative to the magic fd number (whatever numbe is used up to
the userspace app). The fd is inherited on exec, so sub-programs that
are passed a path relative to it still work.

It doesn't need kernel support which is nice.

It also restricts the problem to passing paths to other processes that
are not subprocesses (eg via rpc). But as each process can have its own
namespace this will always be an issue that needs careful treatment, and
the pain of adjusting software to realpath() it is much lower than
modifying every path in every piece of software. That approach was
already tried and sucks.

thanks -mike
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-04-06 15:22    [W:0.058 / U:22.872 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site