1Patches applied to file 5.14 sources tree before generating magic.mgc 2and before running create_data_file.php to create data_file.c. 3 4 5 6From ef2329cf71acb59204dd981e2c6cce6c81fe467c Mon Sep 17 00:00:00 2001 7From: Christos Zoulas <christos@zoulas.com> 8Date: Mon, 25 Mar 2013 14:06:55 +0000 9Subject: [PATCH] limit to 100 repetitions to avoid excessive backtracking 10 Carsten Wolff 11 12--- 13 magic/Magdir/commands | 4 ++-- 14 1 file changed, 2 insertions(+), 2 deletions(-) 15 16diff --git a/magic/Magdir/commands b/magic/Magdir/commands 17index 67c3eee..4a7d8dd 100644 18--- a/magic/Magdir/commands 19+++ b/magic/Magdir/commands 20@@ -49,7 +49,7 @@ 21 !:mime text/x-awk 22 0 string/wt #!\ /usr/bin/awk awk script text executable 23 !:mime text/x-awk 24-0 regex =^\\s*BEGIN\\s*[{] awk script text 25+0 regex =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text 26 27 # AT&T Bell Labs' Plan 9 shell 28 0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable 29-- 301.8.5.5 31From 0b478f445b6b7540b58af5d1fe583fa9e48fd745 Mon Sep 17 00:00:00 2001 32From: Christos Zoulas <christos@zoulas.com> 33Date: Wed, 28 May 2014 19:52:36 +0000 34Subject: [PATCH] further optimize awk by not looking for the BEGIN regex until 35 we found the BEGIN (Jan Kaluza) 36 37--- 38 magic/Magdir/commands | 5 +++-- 39 1 file changed, 3 insertions(+), 2 deletions(-) 40 41diff --git a/magic/Magdir/commands b/magic/Magdir/commands 42index bfffdef..26b2869 100644 43--- a/magic/Magdir/commands 44+++ b/magic/Magdir/commands 45@@ -49,7 +49,8 @@ 46 !:mime text/x-awk 47 0 string/wt #!\ /usr/bin/awk awk script text executable 48 !:mime text/x-awk 49-0 regex =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text 50+0 search/16384 BEGIN 51+>0 regex =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text 52 53 # AT&T Bell Labs' Plan 9 shell 54 0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable 55-- 562.0.3 57 58From 71a8b6c0d758acb0f73e2e51421a711b5e9d6668 Mon Sep 17 00:00:00 2001 59From: Christos Zoulas <christos@zoulas.com> 60Date: Fri, 30 May 2014 16:48:44 +0000 61Subject: [PATCH] Limit regex search for BEGIN to the first 4K of the file. 62 63--- 64 magic/Magdir/commands | 5 ++--- 65 1 file changed, 2 insertions(+), 3 deletions(-) 66 67diff --git a/magic/Magdir/commands b/magic/Magdir/commands 68index 26b2869..bcd0f43 100644 69--- a/magic/Magdir/commands 70+++ b/magic/Magdir/commands 71@@ -49,8 +49,7 @@ 72 !:mime text/x-awk 73 0 string/wt #!\ /usr/bin/awk awk script text executable 74 !:mime text/x-awk 75-0 search/16384 BEGIN 76->0 regex =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text 77+0 regex/4096 =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text 78 79 # AT&T Bell Labs' Plan 9 shell 80 0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable 81-- 822.0.3 83 84