Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 336503

Summary: Emerge from sys-apps/portage-2.1.9 with usersync uses root temporary directory for syncing
Product: Portage Development Reporter: Léo <deleted_email_KsJQa>
Component: UnclassifiedAssignee: Portage team <dev-portage>
Severity: normal Keywords: InVCS, REGRESSION
Priority: High    
Version: 2.1   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 335925    

Description Léo 2010-09-09 00:27:40 UTC
I upgraded from portage- to 2.1.9 (same with, and now `emerge --sync` gives me the following fatal error message:

rsync: ERROR: cannot stat destination "/tmp/.private/root/tmpa6NzON": Permission denied (13)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(554) [receiver=3.0.6]

I use FEATURES="usersync", so Emerge has Rsync use the "portage" user for syncing. However, I also use pam_mktemp, so my root temporary directory (/tmp/.private/root) is not accessible to any other user, and Rsync cannot access it.

I tried downgrading to, and I can sync without problem. Keeping 2.1.9 and deactivating FEATURES="usersync" also works without problem.

I don't have enough time to check precisely what changed, but Emerge should have Rsync use PORTAGE_TMPDIR for temporary files which do not go directly into PORTDIR.

Thanks in advance to anyone who will work on this.
Comment 1 Zac Medico gentoo-dev 2010-09-09 00:33:35 UTC
We'll have to review all of the tempfile code in various places, to make sure it all uses PORTAGE_TMPDIR.
Comment 3 Zac Medico gentoo-dev 2010-09-10 20:29:22 UTC
This is fixed in and 2.2_rc79.
Comment 4 Larry the Git Cow gentoo-dev 2019-01-03 07:11:10 UTC
The bug has been referenced in the following commit(s):

commit 8ddc902ba8cb4712a2a8b49f46951c8ec326a678
Author:     Zac Medico <>
AuthorDate: 2019-01-03 02:48:32 +0000
Commit:     Zac Medico <>
CommitDate: 2019-01-03 06:21:42 +0000

    rsync: use ${PORTAGE_TMPDIR}/portage (bug 671808)
    Write temporary timestamp files in ${PORTAGE_TMPDIR}/portage,
    since writing files directly in ${PORTAGE_TMPDIR} is generally
    unexpected. Also, use the rsync --inplace option, since it's
    writing to a temp file created in advance and the usersync
    user does not necessarily have write access to the parent
    Fixes: 3f7f72cf339d ("Bug #336503 - Use PORTAGE_TMPDIR for the emerge --sync server timestamp")
    Signed-off-by: Zac Medico <>

 lib/portage/sync/modules/rsync/ | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)