os.makedirs(myportdir,0o755)
st = os.stat(myportdir)
+ usersync_uid = None
spawn_kwargs = {}
spawn_kwargs["env"] = settings.environ()
if 'usersync' in settings.features and \
else:
# Drop privileges when syncing, in order to match
# existing uid/gid settings.
+ usersync_uid = st.st_uid
spawn_kwargs["uid"] = st.st_uid
spawn_kwargs["gid"] = st.st_gid
spawn_kwargs["groups"] = [st.st_gid]
from tempfile import mkstemp
fd, tmpservertimestampfile = mkstemp()
os.close(fd)
+ if usersync_uid is not None:
+ portage.util.apply_permissions(tmpservertimestampfile,
+ uid=usersync_uid)
mycommand = rsynccommand[:]
mycommand.append(dosyncuri.rstrip("/") + \
"/metadata/timestamp.chk")
signal.alarm(rsync_initial_timeout)
try:
mypids.extend(portage.process.spawn(
- mycommand, env=settings.environ(), returnpid=True))
+ mycommand, returnpid=True, **spawn_kwargs))
exitcode = os.waitpid(mypids[0], 0)[1]
+ if usersync_uid is not None:
+ portage.util.apply_permissions(tmpservertimestampfile,
+ uid=os.getuid())
content = portage.grabfile(tmpservertimestampfile)
finally:
if rsync_initial_timeout: