summaryrefslogtreecommitdiffstats
path: root/patches/05_fix-bad-regex-in-awk-script.patch
blob: cf9aeeb959c26571ef6a9f83fabac02cdae6de44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From: "P. J. McDermott" <pjm@nac.net>
Description: Fix "bad regex" in scripts/gen-sorted.awk
 BusyBox awk parses this:
 .
     sub(/\/[^/]+$/, "", subdir);
 .
 into this (using POSIX.1 terminal symbols):
 .
     BUILTIN_FUNC_NAME:  sub
     '(':                (
     ERE:                \/[^
 .
 and fails because it cannot compile the regular expression "\/[^".
 .
 The slash in the bracket expression must be escaped to be parsed as expected in
 BusyBox awk.

diff -Naur src.orig/libc/scripts/gen-sorted.awk src/libc/scripts/gen-sorted.awk
--- src.orig/libc/scripts/gen-sorted.awk	2006-08-16 21:18:26.000000000 -0400
+++ src/libc/scripts/gen-sorted.awk	2013-06-21 10:37:33.855053579 -0400
@@ -16,7 +16,7 @@
 {
   subdir = type = FILENAME;
   sub(/^.*\//, "", type);
-  sub(/\/[^/]+$/, "", subdir);
+  sub(/\/[^\/]+$/, "", subdir);
   sub(/^.*\//, "", subdir);
   thisdir = "";
 }
@@ -56,13 +56,13 @@
     # The Subdirs file comes from an add-on that should have the subdirectory.
     dir = FILENAME;
     do
-      sub(/\/[^/]+$/, "", dir);
+      sub(/\/[^\/]+$/, "", dir);
     while (dir !~ /\/sysdeps$/);
     sub(/\/sysdeps$/, "", dir);
     if (system("test -d " dir "/" thisdir) == 0)
       dir = dir "/" thisdir;
     else {
-      sub(/\/[^/]+$/, "", dir);
+      sub(/\/[^\/]+$/, "", dir);
       if (system("test -d " dir "/" thisdir) == 0)
         dir = dir "/" thisdir;
       else {