plash
[Top][All Lists]
Advanced

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

Re: [Plash] executable objects and cwd


From: Toby Murray
Subject: Re: [Plash] executable objects and cwd
Date: Mon, 19 Jun 2006 10:09:56 +0930
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414

Mark Seaborn wrote:

exec-object doesn't implement setting the cwd.

I have just fixed this in SVN.

Cool, thanks.

Suppose your cwd is "/home/fred":

if I run

my_getcwd /somedir

(where /somedir is the path to the 'getcwd' binary)
instead it says "leaving cwd unset".

Here the namespace created by the shell for this command only contains
"/somedir".  The namespace doesn't contain "/home/fred" so the cwd is
not set.  The shell doesn't add in defaults like "/usr", "/bin"
etc. when invoking executable objects.  exec-object later unions this
namespace with another namespace that contains "/somedir", but the
shell doesn't know about that.
I think I see what you mean. I might create an executable object with its initial namespace containing "/home/fred". I might then invoke it passing a namespace with "/somedir". (Its eventual namespace will contain both "/home/fred" and "/somedir", right?) If my cwd is /home/fred, the shell can't determine that this will in-fact end up being in the executable object's namespace since it only knows about the namespace being passed with the invocation.

Is there a problem with the shell sending the cwd as an argument regardless of whether it thinks it will be in the executable object's namespace? It would be up to the object to determine whether the argument passed by the shell was actually in its namespace and if so, then set its cwd.

The other solution would be to add a method to query the executable object about its initial namespace. That would allow the shell to properly determine whether it should pass the cwd argument.

--
Toby Murray
Advanced Computer Capabilities Group
Information Networks Division
DSTO, Australia

IMPORTANT: This e-mail remains the property of the Australian Defence
Organisation and is subject to the jurisdiction of section 70 of the
Crimes Act 1914. If you have received this e-mail in error, you are
requested to contact the sender and delete the e-mail.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]