Re: execution of /var/folders/ fink failed, exit code 126
Alexander Hansen <[email protected]>
| Newsgroups | gmane.os.apple.fink.core |
|---|---|
| Organization | Fink Core Team |
| Message-ID | <[email protected]> |
On 7/4/12 11:07 AM, Alexander Hansen wrote:
> On 7/4/12 10:55 AM, Alexander Hansen wrote:
>> On 7/4/12 10:39 AM, B Duart wrote:
>>> hi,
>>>
>>> re: http://sourceforge.net/mailarchive/forum.php?thread_name=4FDA1C5F.7020003%40gmail.com&forum_name=fink-users
>>>
>>> $ fink selfupdate
>>> ...
>>> sudo -u fink-bld [ENV] sh
>>> -c/var/folders/1b/q6ndjg294bx6zs0z2m7wkqw80000gn/T/fink.v5Tqu
>>> sh: /var/folders/1b/q6ndjg294bx6zs0z2m7wkqw80000gn/T/fink.v5Tqu:
>>> Permission denied
>>> ### execution of
>>> /var/folders/1b/q6ndjg294bx6zs0z2m7wkqw80000gn/T/fink.v5Tqu failed, exit
>>> code 126
>>> Removing runtime build-lock...
>>> Removing build-lock package...
>>> /sw/bin/dpkg-lockwait -r fink-buildlock-fink-mirrors-0.33.2.1-1
>>> (Reading database ... 21722 files and directories currently installed.)
>>> Removing fink-buildlock-fink-mirrors-0.33.2.1-1 ...
>>> Failed: phase unpacking 'fink-mirrors-0.33.2.1.tar.gz':
>>> fink-mirrors-0.33.2.1-1 failed
>>>
>>>
>>> ---FYI---
>>>
>>> my usual root environment is established with:
>>>
>>> $ /usr/bin/sudo -E -s
>>>
>>> and i was experiencing the above failure.
>>>
>>> i sudo’d without the -E switch and selfupdate succeeded.
>>>
>>>
>>> hope that helps!
>>>
>>>
>>> regards,
>>>
>>> -brian
>>>
>>
>> Forwarding this onto the fink-core list, because fink isn't my personal
>> package.
>>
>
> I can confirm this behavior. Unlike in jfm's case (cf. the mailarchive
> link above), this doesn't require having a root user or any special
> fink.conf setting, so it's easily reproducible on a 'vanilla' fink setup
> via:
>
> /usr/bin/sudo -E -s
> fink build <some package that doesn't force building as root>
>
> Packages with BuildAsNobody: false don't trigger this, and the
> --no-build-as-nobody override works, too.
>
Following up, (and it should have been clear to me initially :-( ) the
issue here is that fink is trying to write in the only-root-writable
/var/folders when 'sudo -E' is used, as would case when building as root:
sudo -u fink-bld [ENV] sh
-c/var/folders/31/rrfrp0yx6pv3662971cj4hgc0000gn/T/fink.mGk15
sh: /var/folders/31/rrfrp0yx6pv3662971cj4hgc0000gn/T/fink.mGk15:
Permission denied
versus the world-writable /tmp when 'sudo -E' is not used:
sudo -u fink-bld [ENV] sh -c/tmp/fink.pu9JB
<build continues>
The culprit appears to be the TMPDIR environment variable:
$ printenv TMPDIR
/var/folders/31/rrfrp0yx6pv3662971cj4hgc0000gn/T/
Alexanders-MacBook-Pro:~ hansen$ sudo -s
bash-3.2# printenv TMPDIR
bash-3.2# exit
exit
$ sudo -E -s
bash-3.2# printenv TMPDIR
/var/folders/31/rrfrp0yx6pv3662971cj4hgc0000gn/T/
And cf. my failure message above.
My thought is that we'd want to unset TMPDIR in
Fink::Services::execute() in the following block (non-root builds):
if ($drop_root) {
# sudo can clear or change the env, so we need to re-establish
# the env that existed outside the sudo
@wrap = map "$_=$ENV{$_}", sort keys %ENV;
unshift @wrap, 'env' if @wrap;
my $sudo_cmd = "sudo -u " . Fink::Config::build_as_user_group()->{'user'};
@wrap = (split(' ', $sudo_cmd), @wrap, qw/ sh -c /);
$wrap_token = "$sudo_cmd [ENV] sh -c ";
}
--
Alexander Hansen, Ph.D.
Fink User Liaison
My package updates: http://finkakh.wordpress.com/
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
fink-core mailing list
[email protected]
List archive:
http://news.gmane.org/gmane.os.apple.fink.core
Subscription management:
https://lists.sourceforge.net/lists/listinfo/fink-core