Re: [PATCH] Add a /proc/self/exedir link

From: Mike Hearn
Date: Thu Apr 06 2006 - 19:26:33 EST


bin/foo calls bin/bar refering to /proc/self/fd/999
bin_2/bar does dup2(open(get_my_exedir()), 999) ***FUBAR***

So don't do that. Treat it as the same case as sending a file path via RPC: make sure it's resolved relative to the namespace the program is in and not anything under /proc/self.

In practice most desktop apps use "prefix paths" to locate their own data files. They don't usually send those file paths to other processes, not even in the case of things like GIMP plugins.

So whilst I agree you have identified a place where it breaks, I don't think it invalidates the scheme.

There may be no "real path" corresponding to /proc/self/fd/4711.

Only in a pathological case like running a program that you then rm -rf the prefix of, in which case, you lose whatever happens.

IMO it's still best to just symlink the program directory to the correct place and make the programs search in e.g. ~/opt/ and /opt/.

That also suffers from namespace conflicts ;)

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