From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1R10US-0006eg-9X for garchives@archives.gentoo.org; Tue, 06 Sep 2011 18:35:20 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1DAA821C1A9; Tue, 6 Sep 2011 18:35:13 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id CC0B221C1A9 for ; Tue, 6 Sep 2011 18:35:12 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 543981B4041 for ; Tue, 6 Sep 2011 18:35:12 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 98BCB80042 for ; Tue, 6 Sep 2011 18:35:11 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/__init__.py pym/portage/dbapi/vartree.py X-VCS-Directories: pym/portage/dbapi/ pym/portage/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: eab5a6ee1abff1fbf142cf1558ba940b6d4b270a Date: Tue, 6 Sep 2011 18:35:11 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: b76e963936f48ba7198e51d0a011a8a2 commit: eab5a6ee1abff1fbf142cf1558ba940b6d4b270a Author: Zac Medico gentoo org> AuthorDate: Tue Sep 6 18:34:57 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Tue Sep 6 18:34:57 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Deab5a6ee merge: avoid abssymlink readlink call This will avoid the "OSError: [Errno 2] No such file or directory" that is triggered inside abssymlink if the merge encoding is not ascii or utf_8, as shown in bug #382021. --- pym/portage/__init__.py | 7 +++++-- pym/portage/dbapi/vartree.py | 7 ++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 901ea2c..d73ea6d 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -391,9 +391,12 @@ def getcwd(): return "/" getcwd() =20 -def abssymlink(symlink): +def abssymlink(symlink, target=3DNone): "This reads symlinks, resolving the relative symlinks, and returning th= e absolute." - mylink=3Dos.readlink(symlink) + if target is None: + mylink =3D target + else: + mylink =3D os.readlink(symlink) if mylink[0] !=3D '/': mydir=3Dos.path.dirname(symlink) mylink=3Dmydir+"/"+mylink diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index bafe138..4d0a6dd 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -4013,7 +4013,12 @@ class dblink(object): os.unlink(mysrc) os.symlink(myto, mysrc) =20 - myabsto =3D abssymlink(mysrc) + # Pass in the symlink target in order to bypass the + # os.readlink() call inside abssymlink(), since that + # call is unsafe if the merge encoding is not ascii + # or utf_8 (see bug #382021). + myabsto =3D abssymlink(mysrc, target=3Dmyto) + if myabsto.startswith(srcroot): myabsto =3D myabsto[len(srcroot):] myabsto =3D myabsto.lstrip(sep)