You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/04 05:17:32 UTC
svn commit: r1077462 - in
/hadoop/common/branches/branch-0.20-security-patches/src:
mapred/org/apache/hadoop/mapred/JobHistory.java
test/org/apache/hadoop/mapred/TestJobHistoryParsing.java
Author: omalley
Date: Fri Mar 4 04:17:31 2011
New Revision: 1077462
URL: http://svn.apache.org/viewvc?rev=1077462&view=rev
Log:
commit 7c5f362bb4182b75602a32b601c4064b70e81318
Author: Arun C Murthy <ac...@apache.org>
Date: Thu May 13 23:54:54 2010 -0700
MAPREDUCE-1442. Fixed regex in job-history related to parsing Counter values. Contributed by Luke Lu.
From https://issues.apache.org/jira/secure/attachment/12444349/mr-1442-y20s-v1.patch
+++ b/YAHOO-CHANGES.txt
+ MAPREDUCE-1442. Fixed regex in job-history related to parsing Counter
+ values. (Luke Lu via acmurthy)
+
Modified:
hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobHistory.java
hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestJobHistoryParsing.java
Modified: hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobHistory.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobHistory.java?rev=1077462&r1=1077461&r2=1077462&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobHistory.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobHistory.java Fri Mar 4 04:17:31 2011
@@ -95,7 +95,7 @@ public class JobHistory {
static final String KEY = "(\\w+)";
// value is any character other than quote, but escaped quotes can be there
- static final String VALUE = "[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*";
+ static final String VALUE = "[^\"\\\\]*+(?:\\\\.[^\"\\\\]*+)*+";
static final Pattern pattern = Pattern.compile(KEY + "=" + "\"" + VALUE + "\"");
Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestJobHistoryParsing.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestJobHistoryParsing.java?rev=1077462&r1=1077461&r2=1077462&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestJobHistoryParsing.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestJobHistoryParsing.java Fri Mar 4 04:17:31 2011
@@ -73,7 +73,15 @@ public class TestJobHistoryParsing exte
"\t\b\n\f\"\n in it";
String value4 = "Value ends with escape\\";
String value5 = "Value ends with \\\" \\.\n";
-
+ StringBuilder sb = new StringBuilder("Longer value with many escaped "+
+ "chars, which tends to overflow the stack of brittle regex parsers");
+ for (int i = 0; i < 1000; ++i) {
+ sb.append(",");
+ sb.append("\\split.");
+ sb.append(i);
+ }
+ String value6 = sb.toString();
+
// Log the history version
JobHistory.MetaInfoManager.logMetaInfo(historyWriter);
@@ -82,8 +90,10 @@ public class TestJobHistoryParsing exte
Keys.TRACKER_NAME,
Keys.JOBNAME,
Keys.JOBCONF,
- Keys.USER},
- new String[] {value1, value2, value3, value4, value5});
+ Keys.USER,
+ Keys.SPLITS},
+ new String[] {value1, value2, value3, value4, value5,
+ value6});
// close history file
out.close();
historyWriter.remove(out);
@@ -99,5 +109,6 @@ public class TestJobHistoryParsing exte
assertEquals(value3, job.get(Keys.JOBNAME));
assertEquals(value4, job.get(Keys.JOBCONF));
assertEquals(value5, job.get(Keys.USER));
+ assertEquals(value6, job.get(Keys.SPLITS));
}
}