* [gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/rsync/
@ 2018-07-23 19:42 Zac Medico
0 siblings, 0 replies; 6+ messages in thread
From: Zac Medico @ 2018-07-23 19:42 UTC (permalink / raw
To: gentoo-commits
commit: e356d53ceb10ee24969ee79766f30e5004395f81
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 23 19:39:39 2018 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jul 23 19:39:39 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=e356d53c
RsyncSync: fix _commit_download usersync privileges (bug 661834)
Fix the _commit_download to drop privileges for the rsync call,
in order to prevent it from creating files owned by root.
Fixes: 84822ef7a214 ("rsync: quarantine data prior to verification (bug 660410)")
Bug: https://bugs.gentoo.org/661834
lib/portage/sync/modules/rsync/rsync.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/portage/sync/modules/rsync/rsync.py b/lib/portage/sync/modules/rsync/rsync.py
index fb1960a3c..56e38631e 100644
--- a/lib/portage/sync/modules/rsync/rsync.py
+++ b/lib/portage/sync/modules/rsync/rsync.py
@@ -94,7 +94,7 @@ class RsyncSync(NewBase):
rsynccommand.append('--exclude=/%s' % os.path.basename(download_dir))
rsynccommand.append('%s/' % download_dir.rstrip('/'))
rsynccommand.append('%s/' % self.repo.location)
- exitcode = subprocess.call(rsynccommand)
+ exitcode = portage.process.spawn(rsynccommand, **self.spawn_kwargs)
return exitcode
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/rsync/
@ 2019-01-03 7:11 Zac Medico
0 siblings, 0 replies; 6+ messages in thread
From: Zac Medico @ 2019-01-03 7:11 UTC (permalink / raw
To: gentoo-commits
commit: 8ddc902ba8cb4712a2a8b49f46951c8ec326a678
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 3 02:48:32 2019 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Jan 3 06:21:42 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=8ddc902b
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
directory.
Bug: https://bugs.gentoo.org/671808
Bug: https://bugs.gentoo.org/336503
Fixes: 3f7f72cf339d ("Bug #336503 - Use PORTAGE_TMPDIR for the emerge --sync server timestamp")
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
lib/portage/sync/modules/rsync/rsync.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/portage/sync/modules/rsync/rsync.py b/lib/portage/sync/modules/rsync/rsync.py
index 0f8221776..e6f2688f8 100644
--- a/lib/portage/sync/modules/rsync/rsync.py
+++ b/lib/portage/sync/modules/rsync/rsync.py
@@ -583,11 +583,17 @@ class RsyncSync(NewBase):
# Temporary file for remote server timestamp comparison.
# NOTE: If FEATURES=usersync is enabled then the tempfile
# needs to be in a directory that's readable by the usersync
- # user. We assume that PORTAGE_TMPDIR will satisfy this
+ # user. We assume that ${PORTAGE_TMPDIR}/portage will satisfy this
# requirement, since that's not necessarily true for the
# default directory used by the tempfile module.
if self.usersync_uid is not None:
- tmpdir = self.settings['PORTAGE_TMPDIR']
+ tmpdir = os.path.join(self.settings['PORTAGE_TMPDIR'], 'portage')
+ ensure_dirs_kwargs = {}
+ if portage.secpass >= 1:
+ ensure_dirs_kwargs['gid'] = portage.portage_gid
+ ensure_dirs_kwargs['mode'] = 0o70
+ ensure_dirs_kwargs['mask'] = 0
+ portage.util.ensure_dirs(tmpdir, **ensure_dirs_kwargs)
else:
# use default dir from tempfile module
tmpdir = None
@@ -598,6 +604,7 @@ class RsyncSync(NewBase):
portage.util.apply_permissions(tmpservertimestampfile,
uid=self.usersync_uid)
command = rsynccommand[:]
+ command.append('--inplace')
command.append(syncuri.rstrip("/") + \
"/metadata/timestamp.chk")
command.append(tmpservertimestampfile)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/rsync/
@ 2019-08-30 17:38 Zac Medico
0 siblings, 0 replies; 6+ messages in thread
From: Zac Medico @ 2019-08-30 17:38 UTC (permalink / raw
To: gentoo-commits
commit: 7ea06e6d87cd1394fe06c77ed5abad7f4497158d
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 28 17:42:51 2019 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Aug 30 17:07:16 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7ea06e6d
rsync: proxychains compatibility (bug 693026)
Use the original hostname if it resolves to a single IP, since DNS
lookup must occur in the rsync process for compatibility with things
like proxychains that allocate a surrogate IP which is only valid
within the current process.
Bug: https://bugs.gentoo.org/693026
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
lib/portage/sync/modules/rsync/rsync.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/portage/sync/modules/rsync/rsync.py b/lib/portage/sync/modules/rsync/rsync.py
index e6f2688f8..a40e1c854 100644
--- a/lib/portage/sync/modules/rsync/rsync.py
+++ b/lib/portage/sync/modules/rsync/rsync.py
@@ -283,6 +283,13 @@ class RsyncSync(NewBase):
# With some configurations we need to use the plain hostname
# rather than try to resolve the ip addresses (bug #340817).
uris.append(syncuri)
+ elif len(uris) == 1:
+ # Use the original hostname if it resolves to a single IP,
+ # since DNS lookup must occur in the rsync process for
+ # compatibility with things like proxychains that allocate
+ # a surrogate IP which is only valid within the current
+ # process.
+ uris = [syncuri]
# reverse, for use with pop()
uris.reverse()
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/rsync/
@ 2020-08-03 19:30 Zac Medico
0 siblings, 0 replies; 6+ messages in thread
From: Zac Medico @ 2020-08-03 19:30 UTC (permalink / raw
To: gentoo-commits
commit: f57d629053ceb7a5ec48826739625db76a057e20
Author: Aaron Bauman <bman <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 3 19:05:41 2020 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Aug 3 19:21:15 2020 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f57d6290
lib/portage/sync/modules/rsync/rsync.py: fix unused-import
Signed-off-by: Aaron Bauman <bman <AT> gentoo.org>
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
lib/portage/sync/modules/rsync/rsync.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/portage/sync/modules/rsync/rsync.py b/lib/portage/sync/modules/rsync/rsync.py
index 33019534b..4ccf7769f 100644
--- a/lib/portage/sync/modules/rsync/rsync.py
+++ b/lib/portage/sync/modules/rsync/rsync.py
@@ -15,7 +15,6 @@ import tempfile
import portage
from portage import os
from portage import _unicode_decode
-from portage.exception import CommandNotFound
from portage.util import writemsg_level
from portage.output import create_color_func, yellow, blue, bold
good = create_color_func("GOOD")
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/rsync/
@ 2020-09-07 22:52 Zac Medico
0 siblings, 0 replies; 6+ messages in thread
From: Zac Medico @ 2020-09-07 22:52 UTC (permalink / raw
To: gentoo-commits
commit: 051d75acf5e3fbca7c1083cb612e5f07a3a98919
Author: Frédéric Pierret (fepitre) <frederic.pierret <AT> qubes-os <DOT> org>
AuthorDate: Tue Aug 4 13:12:08 2020 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Sep 7 22:49:53 2020 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=051d75ac
rsync: ignore addrinfos with proxy settings
Not doing so makes getting addrinfos failing due to
"Temporary failure in name resolution" due to proxy settings.
An alternative to this solution would be to define a socks.setdefaultproxy
and passing socks.socksocket to socket.
Bug: https://bugs.gentoo.org/740904
See: https://github.com/gentoo/portage/pull/607
Signed-off-by: Frédéric Pierret (fepitre) <frederic.pierret <AT> qubes-os.org>
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
lib/portage/sync/modules/rsync/rsync.py | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/lib/portage/sync/modules/rsync/rsync.py b/lib/portage/sync/modules/rsync/rsync.py
index 88b36ab79..35d1461e4 100644
--- a/lib/portage/sync/modules/rsync/rsync.py
+++ b/lib/portage/sync/modules/rsync/rsync.py
@@ -230,15 +230,16 @@ class RsyncSync(NewBase):
addrinfos = None
uris = []
- try:
- addrinfos = getaddrinfo_validate(
- socket.getaddrinfo(getaddrinfo_host, None,
- family, socket.SOCK_STREAM))
- except socket.error as e:
- writemsg_level(
- "!!! getaddrinfo failed for '%s': %s\n"
- % (_unicode_decode(hostname), str(e)),
- noiselevel=-1, level=logging.ERROR)
+ if 'RSYNC_PROXY' not in self.spawn_kwargs['env']:
+ try:
+ addrinfos = getaddrinfo_validate(
+ socket.getaddrinfo(
+ getaddrinfo_host, None, family, socket.SOCK_STREAM))
+ except socket.error as e:
+ writemsg_level(
+ "!!! getaddrinfo failed for '%s': %s\n"
+ % (_unicode_decode(hostname), str(e)),
+ noiselevel=-1, level=logging.ERROR)
if addrinfos:
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/rsync/
@ 2024-05-26 23:27 Sam James
0 siblings, 0 replies; 6+ messages in thread
From: Sam James @ 2024-05-26 23:27 UTC (permalink / raw
To: gentoo-commits
commit: a671334b7c7b64bc779f1c2bfb4ed659d97c0d19
Author: Pavel Balaev <mail <AT> void <DOT> so>
AuthorDate: Mon Mar 18 11:29:34 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun May 26 23:27:08 2024 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a671334b
sync: don't use ipv6 for rsync when it's disabled
socket.has_ipv6 gives a false result:
$ sysctl net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.all.disable_ipv6 = 1
$ python
Python 3.11.8 (main, Feb 24 2024, 17:10:38) [GCC 13.2.1 20240210] on linux
>>> import socket
>>> socket.has_ipv6
True
This patch uses the portage.process.has_ipv6() function,
which returns the correct result.
Bug: https://bugs.gentoo.org/927241
Signed-off-by: Pavel Balaev <mail <AT> void.so>
Closes: https://github.com/gentoo/portage/pull/1309
Signed-off-by: Sam James <sam <AT> gentoo.org>
lib/portage/sync/modules/rsync/rsync.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/portage/sync/modules/rsync/rsync.py b/lib/portage/sync/modules/rsync/rsync.py
index 15c3eb4da5..e89221ebc9 100644
--- a/lib/portage/sync/modules/rsync/rsync.py
+++ b/lib/portage/sync/modules/rsync/rsync.py
@@ -19,6 +19,7 @@ from portage import _unicode_decode
from portage import os
from portage.const import VCS_DIRS, TIMESTAMP_FORMAT, RSYNC_PACKAGE_ATOM
from portage.output import create_color_func, yellow, blue, bold
+from portage.process import has_ipv6
from portage.sync.getaddrinfo_validate import getaddrinfo_validate
from portage.sync.syncbase import NewBase
from portage.util import writemsg, writemsg_level, writemsg_stdout
@@ -252,9 +253,7 @@ class RsyncSync(NewBase):
family = socket.AF_UNSPEC
if "-4" in all_rsync_opts or "--ipv4" in all_rsync_opts:
family = socket.AF_INET
- elif socket.has_ipv6 and (
- "-6" in all_rsync_opts or "--ipv6" in all_rsync_opts
- ):
+ elif has_ipv6() and ("-6" in all_rsync_opts or "--ipv6" in all_rsync_opts):
family = socket.AF_INET6
addrinfos = None
@@ -278,7 +277,7 @@ class RsyncSync(NewBase):
if addrinfos:
AF_INET = socket.AF_INET
AF_INET6 = None
- if socket.has_ipv6:
+ if has_ipv6():
AF_INET6 = socket.AF_INET6
ips_v4 = []
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-05-26 23:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-03 19:30 [gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/rsync/ Zac Medico
-- strict thread matches above, loose matches on Subject: below --
2024-05-26 23:27 Sam James
2020-09-07 22:52 Zac Medico
2019-08-30 17:38 Zac Medico
2019-01-03 7:11 Zac Medico
2018-07-23 19:42 Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox