]> git.draconx.ca Git - dxcommon.git/commitdiff
gen-strtab.awk: Work around HP-UX shell bug in test case.
authorNick Bowler <nbowler@draconx.ca>
Fri, 17 Nov 2023 08:03:42 +0000 (03:03 -0500)
committerNick Bowler <nbowler@draconx.ca>
Sat, 18 Nov 2023 21:39:56 +0000 (16:39 -0500)
On HP-UX /bin/sh, redirections on "read" in a subshell can drop some
input on the floor.  Since Autotest runs many things in subshells, we
hit this when trying to construct the program to dump the string table.

Rearranging the code to use only a single redirection works around
the problem.

tests/scripts.at

index 880bb6c9b7c81dfd99b14a486147bcc356234a78..dbec2c9024e9d54ec4b133aa6cf34b0a053561b6 100644 (file)
@@ -331,21 +331,18 @@ AT_CHECK([$AWK -f "$srcdir/scripts/gen-strtab.awk" <test.def >test.h])
 sed -n 's/^[[&]]\([[^ ]]*\).*/\1/p' test.def >identifiers
 
 # test 0: sanity test
-AT_DATA([test0.c],
-[[#include "test.h"
+{ cat <<'EOF'
+#include "test.h"
 #include <stdio.h>
 
 int main(void)
 {
   printf("---\n");
-]])
-exec 3<identifiers 4>>test0.c
-while read ident <&3; do
-  AS_ECHO(['  printf("%s\n---\n", '"strtab+$ident);"]) >&4
-done
-AS_ECHO(['  return 0;']) >&4
-AS_ECHO(['}']) >&4
-exec 3<&- 4>&-
+EOF
+while read id; do AS_ECHO(['  printf("%s\n---\n", strtab+'"$id"');']); done
+AS_ECHO(['  return 0;'])
+AS_ECHO(['}'])
+} <identifiers >test0.c
 
 AT_CHECK([$CC -o test0$EXEEXT test0.c && ./test0$EXEEXT], [0], [---
 world