]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
nlcanon: Make it work on OpenBSD.
authorBruno Haible <bruno@clisp.org>
Mon, 11 Aug 2025 09:51:43 +0000 (11:51 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 11 Aug 2025 09:51:43 +0000 (11:51 +0200)
* build-aux/nlcanon.sh.in (sed_convert_crlf): New variable. Use it
instead of a sed script that contains '\r'.

ChangeLog
build-aux/nlcanon.sh.in

index 5173498a3a64d1335ccf66047c29d2460ecb0cd9..7a62d7129b60edec7ec059fd68c3e0b47e3f2f49 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-08-11  Bruno Haible  <bruno@clisp.org>
+
+       nlcanon: Make it work on OpenBSD.
+       * build-aux/nlcanon.sh.in (sed_convert_crlf): New variable. Use it
+       instead of a sed script that contains '\r'.
+
 2025-08-10  Bruno Haible  <bruno@clisp.org>
 
        Use standard way of including <config.h>.
index d5373f0b6c9914c258ada1298d1f067109bf03c7..d43c13b2fca53ff2b0fc3299efd9575f1c4bf4c8 100644 (file)
@@ -110,16 +110,20 @@ then
   trap 'exit_status=$?; func_cleanup_tmpfiles; exit $exit_status' EXIT
   exitcode_file="$tmp/exit"
 
+  # Need to use printf, because OpenBSD and Solaris 'sed' don't interpret \r
+  # as an escape sequence.
+  sed_convert_crlf='s/'`printf '\r'`'$//'
+
   # This is not a program. This is art. :D)
   case "$streams" in
     stdout)
-      { "$@"; echo "$?" > "$exitcode_file"; } | { sed -e 's/\r$//' 2>/dev/null; }
+      { "$@"; echo "$?" > "$exitcode_file"; } | { sed -e "$sed_convert_crlf" 2>/dev/null; }
       ;;
     stderr)
-      { { "$@" 2>&1 1>&3; echo "$?" > "$exitcode_file"; } | { sed -e 's/\r$//' 2>/dev/null; }; } 3>&1 1>&2
+      { { "$@" 2>&1 1>&3; echo "$?" > "$exitcode_file"; } | { sed -e "$sed_convert_crlf" 2>/dev/null; }; } 3>&1 1>&2
       ;;
     *) # both
-      { { "$@" 2>&1 1>&3; echo "$?" > "$exitcode_file"; } | { sed -e 's/\r$//' 2>/dev/null; }; } 3>&1 1>&2 | { sed -e 's/\r$//' 2>/dev/null; }
+      { { "$@" 2>&1 1>&3; echo "$?" > "$exitcode_file"; } | { sed -e "$sed_convert_crlf" 2>/dev/null; }; } 3>&1 1>&2 | { sed -e "$sed_convert_crlf" 2>/dev/null; }
       ;;
   esac
   exit `cat "$exitcode_file"`