From 46cafb3996d827d208d486b85c7f4248a6e8c826 Mon Sep 17 00:00:00 2001
From: Sebastian Luther <SebastianLuther@gmx.de>
Date: Mon, 6 Sep 2010 16:05:46 +0200
Subject: [PATCH] Remove all \a (alert/bell/beep) tokens (bug 336024)

---
 bin/ebuild-helpers/prepstrip         |  2 +-
 bin/ebuild.sh                        |  1 -
 bin/misc-functions.sh                | 46 +++++++++++++---------------
 pym/_emerge/unmerge.py               |  4 +--
 pym/portage/package/ebuild/config.py |  2 +-
 5 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 2bd5bb102..ceb1ef047 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -108,7 +108,7 @@ if ! hasq binchecks ${RESTRICT} && \
 	fi
 	sed -e "/^\$/d" -e "s#^#/#" -i "$log"
 	if [[ -s $log ]] ; then
-		vecho -e "\a\n"
+		vecho -e "\n"
 		eqawarn "QA Notice: Pre-stripped files found:"
 		eqawarn "$(<"$log")"
 	else
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index d100bf43a..7c3189ab8 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -2181,7 +2181,6 @@ ebuild_main() {
 
 				local x
 				for x in 1 2 3 4 5 6 7 8; do
-					echo -ne "\a"
 					LC_ALL=C sleep 0.25
 				done
 
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 1edacadca..fd0a21866 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -157,7 +157,6 @@ install_qa_check() {
 	# Now we look for all world writable files.
 	local i
 	for i in $(find "${D}/" -type f -perm -2); do
-		vecho -ne '\a'
 		vecho "QA Security Notice:"
 		vecho "- ${i:${#D}:${#i}} will be a world writable file."
 		vecho "- This may or may not be a security problem, most of the time it is one."
@@ -185,12 +184,12 @@ install_qa_check() {
 			xargs -0 scanelf -qyRF '%r %p' | grep '$ORIGIN'
 		)
 		if [[ -n ${f}${x} ]] ; then
-			vecho -ne '\a\n'
+			vecho -ne '\n'
 			eqawarn "QA Notice: The following files contain insecure RUNPATHs"
 			eqawarn " Please file a bug about this at http://bugs.gentoo.org/"
 			eqawarn " with the maintaining herd of the package."
 			eqawarn "${f}${f:+${x:+\n}}${x}"
-			vecho -ne '\a\n'
+			vecho -ne '\n'
 			if [[ -n ${x} ]] || has stricter ${FEATURES} ; then
 				insecure_rpath=1
 			else
@@ -211,7 +210,7 @@ install_qa_check() {
 		f=$(scanelf -qyRF '%t %p' "${D}" | grep -v 'usr/lib/debug/')
 		if [[ -n ${f} ]] ; then
 			scanelf -qyRAF '%T %p' "${PORTAGE_BUILDDIR}"/ &> "${T}"/scanelf-textrel.log
-			vecho -ne '\a\n'
+			vecho -ne '\n'
 			eqawarn "QA Notice: The following files contain runtime text relocations"
 			eqawarn " Text relocations force the dynamic linker to perform extra"
 			eqawarn " work at startup, waste system resources, and may pose a security"
@@ -220,7 +219,7 @@ install_qa_check() {
 			eqawarn " For more information, see http://hardened.gentoo.org/pic-fix-guide.xml"
 			eqawarn " Please include the following list of files in your report:"
 			eqawarn "${f}"
-			vecho -ne '\a\n'
+			vecho -ne '\n'
 			die_msg="${die_msg} textrels,"
 			sleep 1
 		fi
@@ -256,7 +255,7 @@ install_qa_check() {
 		if [[ -n ${f} ]] ; then
 			# One more pass to help devs track down the source
 			scanelf -qyRAF '%e %p' "${PORTAGE_BUILDDIR}"/ &> "${T}"/scanelf-execstack.log
-			vecho -ne '\a\n'
+			vecho -ne '\n'
 			eqawarn "QA Notice: The following files contain writable and executable sections"
 			eqawarn " Files with such sections will not work properly (or at all!) on some"
 			eqawarn " architectures/operating systems.  A bug should be filed at"
@@ -266,7 +265,7 @@ install_qa_check() {
 			eqawarn " Note: Bugs should be filed for the respective maintainers"
 			eqawarn " of the package in question and not hardened@g.o."
 			eqawarn "${f}"
-			vecho -ne '\a\n'
+			vecho -ne '\n'
 			die_msg="${die_msg} execstacks"
 			sleep 1
 		fi
@@ -299,11 +298,11 @@ install_qa_check() {
 					-i "${T}"/scanelf-ignored-LDFLAGS.log
 				f=$(<"${T}"/scanelf-ignored-LDFLAGS.log)
 				if [[ -n ${f} ]] ; then
-					vecho -ne '\a\n'
+					vecho -ne '\n'
 					eqawarn "${BAD}QA Notice: Files built without respecting LDFLAGS have been detected${NORMAL}"
 					eqawarn " Please include the following list of files in your report:"
 					eqawarn "${f}"
-					vecho -ne '\a\n'
+					vecho -ne '\n'
 					sleep 1
 				else
 					rm -f "${T}"/scanelf-ignored-LDFLAGS.log
@@ -373,10 +372,10 @@ install_qa_check() {
 			sed -e "/^\$/d" -i "${T}"/scanelf-missing-SONAME.log
 			f=$(<"${T}"/scanelf-missing-SONAME.log)
 			if [[ -n ${f} ]] ; then
-				vecho -ne '\a\n'
+				vecho -ne '\n'
 				eqawarn "QA Notice: The following shared libraries lack a SONAME"
 				eqawarn "${f}"
-				vecho -ne '\a\n'
+				vecho -ne '\n'
 				sleep 1
 			else
 				rm -f "${T}"/scanelf-missing-SONAME.log
@@ -407,10 +406,10 @@ install_qa_check() {
 			sed -e "/^\$/d" -i "${T}"/scanelf-missing-NEEDED.log
 			f=$(<"${T}"/scanelf-missing-NEEDED.log)
 			if [[ -n ${f} ]] ; then
-				vecho -ne '\a\n'
+				vecho -ne '\n'
 				eqawarn "QA Notice: The following shared libraries lack NEEDED entries"
 				eqawarn "${f}"
-				vecho -ne '\a\n'
+				vecho -ne '\n'
 				sleep 1
 			else
 				rm -f "${T}"/scanelf-missing-NEEDED.log
@@ -479,7 +478,7 @@ install_qa_check() {
 			[[ ! -L ${j} ]] && continue
 			linkdest=$(readlink "${j}")
 			if [[ ${linkdest} == /* ]] ; then
-				vecho -ne '\a\n'
+				vecho -ne '\n'
 				eqawarn "QA Notice: Found an absolute symlink in a library directory:"
 				eqawarn "           ${j#${D}} -> ${linkdest}"
 				eqawarn "           It should be a relative symlink if in the same directory"
@@ -499,7 +498,7 @@ install_qa_check() {
 		if [[ ! -e ${s} ]] ; then
 			s=${s%usr/*}${s##*/usr/}
 			if [[ -e ${s} ]] ; then
-				vecho -ne '\a\n'
+				vecho -ne '\n'
 				eqawarn "QA Notice: Missing gen_usr_ldscript for ${s##*/}"
 	 			abort="yes"
 			fi
@@ -510,10 +509,10 @@ install_qa_check() {
 	# Make sure people don't store libtool files or static libs in /lib
 	f=$(ls "${D}"lib*/*.{a,la} 2>/dev/null)
 	if [[ -n ${f} ]] ; then
-		vecho -ne '\a\n'
+		vecho -ne '\n'
 		eqawarn "QA Notice: Excessive files found in the / partition"
 		eqawarn "${f}"
-		vecho -ne '\a\n'
+		vecho -ne '\n'
 		die "static archives (*.a) and libtool library files (*.la) do not belong in /"
 	fi
 
@@ -522,7 +521,7 @@ install_qa_check() {
 	for a in "${D}"usr/lib*/*.la ; do
 		s=${a##*/}
 		if grep -qs "${D}" "${a}" ; then
-			vecho -ne '\a\n'
+			vecho -ne '\n'
 			eqawarn "QA Notice: ${s} appears to contain PORTAGE_TMPDIR paths"
 			abort="yes"
 		fi
@@ -585,11 +584,11 @@ install_qa_check() {
 			# force C locale to work around slow unicode locales #160234
 			f=$(LC_ALL=C $grep_cmd "${m}" "${PORTAGE_LOG_FILE}")
 			if [[ -n ${f} ]] ; then
-				vecho -ne '\a\n'
+				vecho -ne '\n'
 				eqawarn "QA Notice: Package has poor programming practices which may compile"
 				eqawarn "           fine but exhibit random runtime failures."
 				eqawarn "${f}"
-				vecho -ne '\a\n'
+				vecho -ne '\n'
 				abort="yes"
 			fi
 		done
@@ -622,11 +621,11 @@ install_qa_check() {
 				eerror " with the maintaining herd of the package."
 				eerror
 			else
-				vecho -ne '\a\n'
+				vecho -ne '\n'
 				eqawarn "QA Notice: Package has poor programming practices which may compile"
 				eqawarn "           but will almost certainly crash on 64bit architectures."
 				eqawarn "${f}"
-				vecho -ne '\a\n'
+				vecho -ne '\n'
 			fi
 
 		fi
@@ -795,8 +794,7 @@ preinst_suid_scan() {
 					vecho "- ${install_path} is an approved suid file"
 				else
 					vecho ">>> Removing sbit on non registered ${install_path}"
-					for x in 5 4 3 2 1 0; do echo -ne "\a"; sleep 0.25 ; done
-					vecho -ne "\a"
+					for x in 5 4 3 2 1 0; do sleep 0.25 ; done
 					ls_ret=$(ls -ldh "${i}")
 					chmod ugo-s "${i}"
 					grep "^#${install_path}$" "${sfconf}" > /dev/null || {
diff --git a/pym/_emerge/unmerge.py b/pym/_emerge/unmerge.py
index 8e26e6256..e1d400f81 100644
--- a/pym/_emerge/unmerge.py
+++ b/pym/_emerge/unmerge.py
@@ -427,10 +427,10 @@ def unmerge(root_config, myopts, unmerge_action,
 			#avoid cluttering the preview printout with stuff that isn't getting unmerged
 			continue
 		if not (pkgmap[x]["protected"] or pkgmap[x]["omitted"]) and cp in syslist:
-			writemsg_level(colorize("BAD","\a\n\n!!! " + \
+			writemsg_level(colorize("BAD","\n\n!!! " + \
 				"'%s' is part of your system profile.\n" % cp),
 				level=logging.WARNING, noiselevel=-1)
-			writemsg_level(colorize("WARN","\a!!! Unmerging it may " + \
+			writemsg_level(colorize("WARN","!!! Unmerging it may " + \
 				"be damaging to your system.\n\n"),
 				level=logging.WARNING, noiselevel=-1)
 			if clean_delay and "--pretend" not in myopts and "--ask" not in myopts:
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 2f0958e2d..84cf2e022 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -889,7 +889,7 @@ class config(object):
 		if not self.profile_path or (not os.path.islink(abs_profile_path) and \
 			not os.path.exists(os.path.join(abs_profile_path, "parent")) and \
 			os.path.exists(os.path.join(self["PORTDIR"], "profiles"))):
-			writemsg(_("\a\n\n!!! %s is not a symlink and will probably prevent most merges.\n") % abs_profile_path,
+			writemsg(_("\n\n!!! %s is not a symlink and will probably prevent most merges.\n") % abs_profile_path,
 				noiselevel=-1)
 			writemsg(_("!!! It should point into a profile within %s/profiles/\n") % self["PORTDIR"])
 			writemsg(_("!!! (You can safely ignore this message when syncing. It's harmless.)\n\n\n"))
-- 
2.26.2