public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r11485 - main/trunk/bin
@ 2008-09-01 19:32 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2008-09-01 19:32 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2008-09-01 19:32:26 +0000 (Mon, 01 Sep 2008)
New Revision: 11485

Modified:
   main/trunk/bin/filter-bash-environment.py
Log:
Bug #222091 - Filter out any instances of the \1 character from variable
values since this character multiplies each time that the environment
is saved (strange bash behavior). This can eventually result in
mysterious 'Argument list too long' errors from programs that have
huge strings of \1 characters in their environment.


Modified: main/trunk/bin/filter-bash-environment.py
===================================================================
--- main/trunk/bin/filter-bash-environment.py	2008-09-01 18:48:49 UTC (rev 11484)
+++ main/trunk/bin/filter-bash-environment.py	2008-09-01 19:32:26 UTC (rev 11485)
@@ -25,6 +25,11 @@
 		close_quote_match.group(1) == quote
 
 def filter_bash_environment(pattern, file_in, file_out):
+	# Filter out any instances of the \1 character from variable values
+	# since this character multiplies each time that the environment
+	# is saved (strange bash behavior). This can eventually result in
+	# mysterious 'Argument list too long' errors from programs that have
+	# huge strings of \1 characters in their environment. See bug #222091.
 	here_doc_delim = None
 	in_func = None
 	multi_line_quote = None
@@ -32,7 +37,7 @@
 	for line in file_in:
 		if multi_line_quote is not None:
 			if not multi_line_quote_filter:
-				file_out.write(line)
+				file_out.write(line.replace("\1", ""))
 			if have_end_quote(multi_line_quote, line):
 				multi_line_quote = None
 				multi_line_quote_filter = None
@@ -59,7 +64,7 @@
 								(declare_opts, line[readonly_match.end():])
 						else:
 							line = "declare " + line[readonly_match.end():]
-					file_out.write(line)
+					file_out.write(line.replace("\1", ""))
 				continue
 		if here_doc_delim is not None:
 			if here_doc_delim.match(line):




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-09-01 19:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-01 19:32 [gentoo-commits] portage r11485 - main/trunk/bin Zac Medico (zmedico)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox