Fail to execute a custom local portfile

Lawrence Velázquez larryv at macports.org
Sun Aug 21 07:39:03 PDT 2016


> On Aug 21, 2016, at 10:14 AM, Rainer Müller <raimue at macports.org> wrote:
> 
>> On 2016-08-21 15:37, Giovanni Grieco wrote:
>> 
>> But I can’t install my package via ‘port install’ because MacPorts
>> throws me the following error:
>> 
>> “Unable to execute port: Could not open file:
>> /Users/…/Documents/macports/… /Portfile”
>> 
>> 
>> 
>> I have the file in that directory, I can open and write it. So I don’t
>> know what the problem is.
>> 
>> Permissions are all set to macports:macports 755, both directories and
>> files; port lint doesn’t find any error  related to Portfile; I have
>> sources.conf with my local repository.
> 
> The port command drops privileges to the macports user, which therefore
> needs access to the Portfile.
> 
> You need to check the permissions on all components of the path leading
> up to the Portfile, not just the Portfile itself. In this case, the
> ~/Documents directory would be 0700 by default, if I remember correctly.
> 
> To manually test the access, you can use sudo to switch to this user:
> 
> $ sudo -u macports cat $(port file kwm)
> 
> You can then check all directory permissions with bash like this:
> 
> $ bash -c 'IFS=/; for p in $(port file kwm); do path="${path%/}/$p";
> paths+=("$path"); done; ls -lad "${paths[@]}"'
> 
> Make sure all directories have at least the +x bit set for everyone,
> that allows the macports user to reach through.

If you're not comfortable setting o+x all the way down, you can use ACLs to give search access to just the "macports" user.

	chmod +a 'macports allow search' ~ ~/Documents
	chmod -R o+x ~/Documents/macports

vq


More information about the macports-users mailing list