1 |
Author: zmedico |
2 |
Date: 2008-09-01 19:32:26 +0000 (Mon, 01 Sep 2008) |
3 |
New Revision: 11485 |
4 |
|
5 |
Modified: |
6 |
main/trunk/bin/filter-bash-environment.py |
7 |
Log: |
8 |
Bug #222091 - Filter out any instances of the \1 character from variable |
9 |
values since this character multiplies each time that the environment |
10 |
is saved (strange bash behavior). This can eventually result in |
11 |
mysterious 'Argument list too long' errors from programs that have |
12 |
huge strings of \1 characters in their environment. |
13 |
|
14 |
|
15 |
Modified: main/trunk/bin/filter-bash-environment.py |
16 |
=================================================================== |
17 |
--- main/trunk/bin/filter-bash-environment.py 2008-09-01 18:48:49 UTC (rev 11484) |
18 |
+++ main/trunk/bin/filter-bash-environment.py 2008-09-01 19:32:26 UTC (rev 11485) |
19 |
@@ -25,6 +25,11 @@ |
20 |
close_quote_match.group(1) == quote |
21 |
|
22 |
def filter_bash_environment(pattern, file_in, file_out): |
23 |
+ # Filter out any instances of the \1 character from variable values |
24 |
+ # since this character multiplies each time that the environment |
25 |
+ # is saved (strange bash behavior). This can eventually result in |
26 |
+ # mysterious 'Argument list too long' errors from programs that have |
27 |
+ # huge strings of \1 characters in their environment. See bug #222091. |
28 |
here_doc_delim = None |
29 |
in_func = None |
30 |
multi_line_quote = None |
31 |
@@ -32,7 +37,7 @@ |
32 |
for line in file_in: |
33 |
if multi_line_quote is not None: |
34 |
if not multi_line_quote_filter: |
35 |
- file_out.write(line) |
36 |
+ file_out.write(line.replace("\1", "")) |
37 |
if have_end_quote(multi_line_quote, line): |
38 |
multi_line_quote = None |
39 |
multi_line_quote_filter = None |
40 |
@@ -59,7 +64,7 @@ |
41 |
(declare_opts, line[readonly_match.end():]) |
42 |
else: |
43 |
line = "declare " + line[readonly_match.end():] |
44 |
- file_out.write(line) |
45 |
+ file_out.write(line.replace("\1", "")) |
46 |
continue |
47 |
if here_doc_delim is not None: |
48 |
if here_doc_delim.match(line): |