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 1QcZNz-0005nH-Lo for garchives@archives.gentoo.org; Fri, 01 Jul 2011 08:47:39 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 89E8B1C005; Fri, 1 Jul 2011 08:47:29 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 556301C005 for ; Fri, 1 Jul 2011 08:47:29 +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 DEA252AC02C for ; Fri, 1 Jul 2011 08:47:28 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 033998003D for ; Fri, 1 Jul 2011 08:47:28 +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: <799c576de2afb31cea67cb2b186051bcdae29b1e.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/util/, pym/portage/util/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/tests/util/test_varExpand.py pym/portage/util/__init__.py X-VCS-Directories: pym/portage/tests/util/ pym/portage/util/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 799c576de2afb31cea67cb2b186051bcdae29b1e Date: Fri, 1 Jul 2011 08:47:28 +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: f3d402aee8e72062a977761189770469 commit: 799c576de2afb31cea67cb2b186051bcdae29b1e Author: Zac Medico gentoo org> AuthorDate: Fri Jul 1 08:47:14 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri Jul 1 08:47:14 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D799c576d varexpand: remove escaped newline characters This fixes a regression reported in bug 365033, comment #14. --- pym/portage/tests/util/test_varExpand.py | 8 +++++--- pym/portage/util/__init__.py | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pym/portage/tests/util/test_varExpand.py b/pym/portage/tests= /util/test_varExpand.py index 9dd488e..4af8f80 100644 --- a/pym/portage/tests/util/test_varExpand.py +++ b/pym/portage/tests/util/test_varExpand.py @@ -25,9 +25,10 @@ class VarExpandTestCase(TestCase): """ We want to behave like bash does when expanding a variable assignment in a sourced file, in which case it performs - backslash removal for \\ and \$ but nothing more. Note that - we don't handle escaped quotes here, since genconfig() uses - shlex to handle that earlier. + backslash removal for \\ and \$ but nothing more. It also + removes escaped newline characters. Note that we don't + handle escaped quotes here, since genconfig() uses shlex + to handle that earlier. """ =20 varDict =3D {} @@ -43,6 +44,7 @@ class VarExpandTestCase(TestCase): ("\\n", "\\n"), ("\\r", "\\r"), ("\\t", "\\t"), + ("\\\n", ""), ("\\\"", "\\\""), ("\\'", "\\'"), ] diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py index 85b2ada..5468e28 100644 --- a/pym/portage/util/__init__.py +++ b/pym/portage/util/__init__.py @@ -687,8 +687,9 @@ def varexpand(mystring, mydict=3DNone): # echo -e, but that's not needed for our purposes. We want to # behave like bash does when expanding a variable assignment # in a sourced file, in which case it performs backslash - # removal for \\ and \$ but nothing more. Note that we don't - # handle escaped quotes here, since getconfig() uses shlex + # removal for \\ and \$ but nothing more. It also removes + # escaped newline characters. Note that we don't handle + # escaped quotes here, since getconfig() uses shlex # to handle that earlier. if (pos+1>=3Dlen(mystring)): newstring=3Dnewstring+mystring[pos] @@ -698,6 +699,8 @@ def varexpand(mystring, mydict=3DNone): pos =3D pos + 2 if a in ("\\", "$"): newstring =3D newstring + a + elif a =3D=3D "\n": + pass else: newstring =3D newstring + mystring[pos-2:pos] continue