From 2086eefb7e5c658bf0f99feb2aa4b118b188e2b1 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sat, 18 Apr 2015 23:56:19 +0200 Subject: [PATCH] texi2txt: add workaround for a known bug in "mawk" As reported by Douglas Torrance, the script that generates the plain text documentation from the texinfo source would crash due to the cross- references when the version of awk used is "mawk". This is actually a known bug in mawk: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=172774 It looks like the bug have been fixed in mawk, but Debian is still providing a broken version. To avoid problems, this patch is introducing a workaround in the matching pattern that causes the issue every time it is being used. Signed-off-by: Christophe CURIS --- script/generate-txt-from-texi.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/generate-txt-from-texi.sh b/script/generate-txt-from-texi.sh index 5554e6e7..3800c72c 100755 --- a/script/generate-txt-from-texi.sh +++ b/script/generate-txt-from-texi.sh @@ -212,12 +212,12 @@ function end_conditional(name, local_i) { # with @value; they can also be defined from command-line (-D) # they are stored in the global array "variable[name]" function set_variable(line, local_idx, local_name, local_value) { - gsub(/^[ \t]*/, "", line); + gsub(/^[ \t]+/, "", line); local_idx = match(line, /[ \t]/); if (local_idx > 0) { local_name = substr(line, 1, local_idx - 1); local_value = substr(line, local_idx + 1); - gsub(/^[ \t]*/, "", local_value); + gsub(/^[ \t]+/, "", local_value); } else { local_name = line; local_value = ""; @@ -473,7 +473,7 @@ function new_node(args, local_nb, local_arr, local_i) { if ((local_nb < 1) || (local_nb > 4)) { report_error("bad number of argument " local_nb " for @node at line " NR); } - gsub(/^[ \t]*/, "", local_arr[1]); + gsub(/^[ \t]+/, "", local_arr[1]); gsub(/[ \t]*$/, "", local_arr[1]); if (local_arr[1] == "") { report_error("missing node name for @node at line " NR); @@ -572,7 +572,7 @@ function generate_cross_reference(args, cmd, local_nb, local_arr, local local_arr[1] = execute_commands(local_arr[1]); for (local_i = 1; local_i <= local_nb; local_i++) { - gsub(/^[ \t]*/, "", local_arr[local_i]); + gsub(/^[ \t]+/, "", local_arr[local_i]); gsub(/[ \t]*$/, "", local_arr[local_i]); }