>
> It looks like this patch also contains encoding issues.

Here is the correct version.


Regards,
Evgemy
From: Evgeny Karpov <[email protected]>
Subject: [PATCH] Cygwin: Generalize error handling in gentls_offsets.sh

The patch introduces error handling in gentls_offsets.sh.
Explicit validation for presence of gawk is no longer required.
---
 winsup/cygwin/scripts/gentls_offsets | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/winsup/cygwin/scripts/gentls_offsets 
b/winsup/cygwin/scripts/gentls_offsets
index bf84dd0cb..a364ea57a 100755
--- a/winsup/cygwin/scripts/gentls_offsets
+++ b/winsup/cygwin/scripts/gentls_offsets
@@ -4,14 +4,9 @@ input_file=$1
 output_file=$2
 tmp_file=/tmp/${output_file}.$$
 
+set -eo pipefail # fail if any command or pipeline fails
 trap "rm -f ${tmp_file}" 0 1 2 15
 
-# Check if gawk is available
-if ! command -v gawk &> /dev/null; then
-    echo "$0: gawk not found." >&2
-    exit 1
-fi
-
 # Preprocess cygtls.h and filter out only the member lines from
 # class _cygtls to generate an input file for the cross compiler
 # to generate the member offsets for tlsoffsets-$(target_cpu).h.
@@ -29,14 +24,13 @@ gawk '
   }
   /^class _cygtls$/ {
     # Ok, bump marker, next we are expecting a "public:" line
-    marker=1;
+    if (marker == 0) marker=1;
   }
   /^public:/ {
     # We are only interested in the lines between the first (marker == 2)
     # and the second (marker == 3) "public:" line in class _cygtls.  These
     # are where the members are defined.
     if (marker > 0) ++marker;
-    if (marker > 2) exit;
   }
   {
     if (marker == 2 && $1 != "public:") {
-- 
2.39.5 (Apple Git-154)

Reply via email to