[37344] branches/gsoc08-privileges/base/src/port1.0

Paul Magrath pmagrath at macports.org
Mon Jun 23 14:00:59 PDT 2008


On 23 Jun 2008, at 21:29, Rainer Müller wrote:
>
> Please use an appropriate way to find the home directory of the user
> here, not an hardcoded /Users.
>
> There must be a better way to find the current user than an external
> whoami. If you really need whoami, run it only once at a central  
> place.

It is hardcoded in currently mainly for testing and development  
purposes.
I'll be looking into finding a more reliable way of finding the home  
directory of the user and I will definitely not be finding it more  
than once. I'll use a global variable to store it once found.

> What happens if I run as root and this directory is not writeable?  
> There
> is no /Users/root (it would be /root) and an additional fallback is  
> needed.

The idea would be that if run as root that privileges will be dropped  
(see today's commit). I will be coming back to dealing with the  
situation of a user running macports under su or having logged in as  
root.

> And what if ~/.macports is not writeable?

Not sure why that would ever happen under normal circumstances tbh.  
I'll add some code giving an explicit error message to the user though  
to add to the Tcl permissions exception that would be generated.

> The path ~/.macports should only be listed at one central place so  
> it is
> easier to change it later or customize it.

I'll use a global variable for this too.

> Also, I don't think there should be a warning to the user, just a  
> message.

Really? If any thing I was going to push that down to debug.

> Why are you checking workpath for "~/.macports"?

There turned out to be no reason too. This was removed in my commit  
earlier today.

> There are ports consisting of more than just one Portfile (e.g. vim),
> you need to copy files, too.

Will do. I'll have a look at the Vim port and see what needs to be done.

> You still lock at the old place? I think this needs further  
> investigation.

Em, no. I've changed the workpath so the statefile is now in the new  
place.

> Sorry for coming back to this commit so late.

No problem. Thanks for taking the time! I'll probably come back to you  
again about one or two of these as well as the other stuff we've  
discussed.

Thanks again,

Paul.





More information about the macports-dev mailing list