From e63a78b9f5c2ef2896b6864d92e8652e56549d93 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sat, 20 Mar 2010 18:30:18 +0000 Subject: [PATCH] Merged from trunk -r15815:15825 | 15820 | Bug #309001 - Only trust tar exit status (ignore | | zmedico | decompressor exit status) when unpacking tar files. | | 15821 | Trust tar exit status and ignore bzip2 exit status as in bug | | zmedico | #309001. | | 15822 | Simplyfy the virtual.exists check, and avoid deprecation | | zmedico | warning triggered by cpv_getkey called on an empty string. | | 15823 | Bug #309001 - Use signal(signal.SIGPIPE, signal.SIG_DFL) for | | zmedico | quiet killing of subprocesses by SIGPIPE (as emerge has for | | | a long time). Thanks to Harald van Dijk truedfx@g.o for this | | | patch. | | 15824 | Add references to bug #309001 in comments about SIGPIPE | | zmedico | handling. | | 15825 | Bug #309001 - Install a SIGPIPE handler inside _exec for all | | zmedico | forked processes. | svn path=/main/branches/prefix/; revision=15836 --- bin/ebuild | 2 ++ bin/ebuild.sh | 6 ++---- bin/emerge | 1 + bin/repoman | 4 +--- pym/_emerge/BinpkgExtractorAsync.py | 8 +------- pym/portage/process.py | 3 +++ 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/bin/ebuild b/bin/ebuild index 9b64f42cd..9c6b8fefb 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -17,6 +17,8 @@ try: signal.signal(signal.SIGINT, exithandler) signal.signal(signal.SIGTERM, exithandler) + # Quiet killing of subprocesses by SIGPIPE (see bug #309001). + signal.signal(signal.SIGPIPE, signal.SIG_DFL) except KeyboardInterrupt: sys.exit(1) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 3d6f2ef28..5e217b731 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -362,8 +362,7 @@ unpack() { _unpack_tar() { if [ "${y}" == "tar" ]; then - $1 -dc "$srcdir$x" | tar xof - - assert "$myfail" + $1 -dc "$srcdir$x" | tar xof - || die "$myfail" else $1 -dc "${srcdir}${x}" > ${x%.*} || die "$myfail" fi @@ -378,8 +377,7 @@ unpack() { tar xozf "$srcdir$x" || die "$myfail" ;; tbz|tbz2) - bzip2 -dc "$srcdir$x" | tar xof - - assert "$myfail" + bzip2 -dc "$srcdir$x" | tar xof - || die "$myfail" ;; ZIP|zip|jar) unzip -qo "${srcdir}${x}" || die "$myfail" diff --git a/bin/emerge b/bin/emerge index 05ed9ae91..e88d43e04 100755 --- a/bin/emerge +++ b/bin/emerge @@ -17,6 +17,7 @@ try: signal.signal(signal.SIGINT, exithandler) signal.signal(signal.SIGTERM, exithandler) + # Quiet killing of subprocesses by SIGPIPE (see bug #309001). signal.signal(signal.SIGPIPE, signal.SIG_DFL) except KeyboardInterrupt: diff --git a/bin/repoman b/bin/repoman index 4cdeae5de..13beaa29e 100755 --- a/bin/repoman +++ b/bin/repoman @@ -1419,9 +1419,7 @@ for x in scanlist: if prov_cp != myprovide: stats["virtual.versioned"]+=1 fails["virtual.versioned"].append(x+"/"+y+".ebuild: "+myprovide) - prov_pkg = portage.cpv_getkey( - portage.best(portdb.xmatch("match-all", prov_cp))) - if prov_cp == prov_pkg: + if portdb.cp_list(prov_cp): stats["virtual.exists"]+=1 fails["virtual.exists"].append(x+"/"+y+".ebuild: "+prov_cp) diff --git a/pym/_emerge/BinpkgExtractorAsync.py b/pym/_emerge/BinpkgExtractorAsync.py index 45af54136..e646d9c1b 100644 --- a/pym/_emerge/BinpkgExtractorAsync.py +++ b/pym/_emerge/BinpkgExtractorAsync.py @@ -20,13 +20,7 @@ class BinpkgExtractorAsync(SpawnProcess): def _start(self): self.args = [self._shell_binary, "-c", - ("bzip2 -dqc -- %s | tar -xp -C %s -f - ; " + \ - "p=(${PIPESTATUS[@]}) ; " + \ - "if [ ${p[0]} != 0 ] ; then " + \ - "echo bzip2 failed with status ${p[0]} ; exit ${p[0]} ; fi ; " + \ - "if [ ${p[1]} != 0 ] ; then " + \ - "echo tar failed with status ${p[1]} ; exit ${p[1]} ; fi ; " + \ - "exit 0 ;") % \ + ("bzip2 -dqc -- %s | tar -xp -C %s -f -") % \ (portage._shell_quote(self.pkg_path), portage._shell_quote(self.image_dir))] diff --git a/pym/portage/process.py b/pym/portage/process.py index e7f09cd2d..703e7cc9f 100644 --- a/pym/portage/process.py +++ b/pym/portage/process.py @@ -343,6 +343,9 @@ def _exec(binary, mycommand, opt_name, fd_pipes, env, gid, groups, uid, umask, myargs = [opt_name] myargs.extend(mycommand[1:]) + # Quiet killing of subprocesses by SIGPIPE (see bug #309001). + signal.signal(signal.SIGPIPE, signal.SIG_DFL) + # Set up the command's pipes. my_fds = {} # To protect from cases where direct assignment could -- 2.26.2