From: Bruno Haible Date: Mon, 11 Aug 2025 09:51:43 +0000 (+0200) Subject: nlcanon: Make it work on OpenBSD. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e50f885cd26e42bdd74a10b962029c8b0a6e80d;p=thirdparty%2Fgnulib.git 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'. --- diff --git a/ChangeLog b/ChangeLog index 5173498a3a..7a62d7129b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2025-08-11 Bruno Haible + + 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 Use standard way of including . diff --git a/build-aux/nlcanon.sh.in b/build-aux/nlcanon.sh.in index d5373f0b6c..d43c13b2fc 100644 --- a/build-aux/nlcanon.sh.in +++ b/build-aux/nlcanon.sh.in @@ -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"`