Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 250469 - Unpacking .deb with deb2targz fails when FEATURES="userpriv" is enabled
Summary: Unpacking .deb with deb2targz fails when FEATURES="userpriv" is enabled
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS, REGRESSION
: 254171 254505 255847 (view as bug list)
Depends on:
Blocks: 210077 254662
  Show dependency tree
 
Reported: 2008-12-10 01:00 UTC by William Keaney
Modified: 2009-01-24 04:44 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
don't write to $DISTDIR with deb2targz (deb2targz.patch,1.09 KB, patch)
2009-01-07 23:54 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description William Keaney 2008-12-10 01:00:44 UTC
The directory /var/tmp/portage/$category/$package/distdir is created with the following ownership and file access permissions:
drwxr-xr-x 2 root    portage
Normally this is not a problem, because most packages don't need to write to this directory - it only contains symlinks to the distfiles in /usr/portage/distfiles/.
However, app-misc/ca-certificates' distfile is a .deb package, which portage converts to a gzipped tarball using deb2targz.  This requires writing to the distdir directory, which portage cannot do when run with the userpriv feature because neither the portage user nor the portage group has write access to this directory.

Reproducible: Always

Steps to Reproduce:
1. Add userpriv to your FEATURES
2. emerge app-misc/ca-certificates

Actual Results:  
emerge fails during unpack phase.

Expected Results:  
1) The .tar.gz converted archive should be written to another location to which the portage user has write access.
   or
2) The portage user or group should have write access to the distdir directory within the package build directory.
Comment 1 Joerg Schaible 2009-01-02 15:20:35 UTC
Actually I am not sure what triggers the problem. I have two machines, both configured with FEATURES="sandbox ccache userpriv distlocks", but only one of it is hit by the issue.
Comment 2 William Keaney 2009-01-02 16:51:35 UTC
That's interesting.  I'll try syncing & updating my laptop when I get home tonight, and see if it persists.
Comment 3 Peter Tworek 2009-01-04 20:58:16 UTC
(In reply to comment #1)
> Actually I am not sure what triggers the problem. I have two machines, both
> configured with FEATURES="sandbox ccache userpriv distlocks", but only one of
> it is hit by the issue.
> 

I've recently hit the same problem. Running emerge with FEATURES="-userpriv" solved it for me.
emerge --info | grep FEATURES shows:
ccache collision-protect distlocks fixpackages multilib-strict parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-orphans userfetch userpriv
Comment 4 Robert Buchholz (RETIRED) gentoo-dev 2009-01-07 18:26:06 UTC
This is a Portage bug, here's what happens. When the distfile is a .deb, Portage uses deb2targz to unpack the file. Otherwise, it uses ar (which works, and which might explain why Joerg was not able to reproduce this issue on one box).

deb2targz extracts the file not into the CWD, but into the directory the original file resides. This fails when USERPRIV is enabled. Since there's no parameter to change that, we need Portage to work around this issue:

1) Copy the symlink in $distdir to $workdir.
2) Prefer ar over deb2targz except on systems where it is known not to work and
   disable USERPRIV / fail there.
Comment 5 Zac Medico gentoo-dev 2009-01-07 23:54:03 UTC
Created attachment 177721 [details, diff]
don't write to $DISTDIR with deb2targz

If this patch is saved as /tmp/deb2targz.patch, then it can be applied as follows:

  patch /usr/lib/portage/bin/ebuild.sh /tmp/deb2targz.patch
Comment 6 SpanKY gentoo-dev 2009-01-08 06:20:07 UTC
*** Bug 254171 has been marked as a duplicate of this bug. ***
Comment 7 Zac Medico gentoo-dev 2009-01-11 01:37:10 UTC
*** Bug 254505 has been marked as a duplicate of this bug. ***
Comment 8 Zac Medico gentoo-dev 2009-01-12 20:08:02 UTC
This is fixed in 2.1.6.5 and 2.2_rc21.
Comment 9 Jeroen Roovers (RETIRED) gentoo-dev 2009-01-24 04:43:34 UTC
*** Bug 255847 has been marked as a duplicate of this bug. ***