pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk/wrapper switch $echo statements to printf "%s\n".



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7b50a548e38c
branches:  trunk
changeset: 455023:7b50a548e38c
user:      maya <maya%pkgsrc.org@localhost>
date:      Fri Jun 25 22:02:06 2021 +0000

description:
switch $echo statements to printf "%s\n".
dash considers \1 to be octal escape.

for PR pkg/56248, from Michael Forney's suggestion.
$echo seems to be used for performance here (was previously cat) and not
for compatibility with some esoteric system.

I misunderstood things, and failed to test the last bootstrap diff, breaking
bootstrap on Ubuntu for a while.

diffstat:

 mk/wrapper/gen-transform.sh |  59 ++++++++++++++++++++++----------------------
 1 files changed, 29 insertions(+), 30 deletions(-)

diffs (115 lines):

diff -r 7e0f3a760c87 -r 7b50a548e38c mk/wrapper/gen-transform.sh
--- a/mk/wrapper/gen-transform.sh       Fri Jun 25 21:22:21 2021 +0000
+++ b/mk/wrapper/gen-transform.sh       Fri Jun 25 22:02:06 2021 +0000
@@ -1,6 +1,6 @@
 #! @WRAPPER_SHELL@
 #
-# $NetBSD: gen-transform.sh,v 1.12 2018/08/22 20:48:37 maya Exp $
+# $NetBSD: gen-transform.sh,v 1.13 2021/06/25 22:02:06 maya Exp $
 #
 # Copyright (c) 2004 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -33,7 +33,6 @@
 wrapperlog="${WRAPPER_LOG-@_WRAP_LOG@}"
 debug="${WRAPPER_DEBUG-no}"
 
-echo="@ECHO@"
 test="@TEST@"
 
 . $shell_lib
@@ -135,16 +134,16 @@
                case $_action in
                transform)
                        $debug_log $wrapperlog "   (gen-transform) $_cmd: $@"
-                       $echo "s|^$1\(/[^$_sep]*\.la[$_sep]\)|$2\1|g"
-                       $echo "s|^$1\(/[^$_sep]*\.la\)$|$2\1|g"
+                       printf "%s\n" "s|^$1\(/[^$_sep]*\.la[$_sep]\)|$2\1|g"
+                       printf "%s\n" "s|^$1\(/[^$_sep]*\.la\)$|$2\1|g"
                        ;;
                untransform)
                        $debug_log $wrapperlog "   (gen-transform) $_cmd: $@"
-                       $echo "s|\([$_sep]\)$1\(/[^$_sep]*\.la[$_sep]\)|\1$2\2|g"
-                       $echo "s|\([$_sep]\)$1\(/[^$_sep]*\.la[$_sep]\)|\1$2\2|g"
-                       $echo "s|\([$_sep]\)$1\(/[^$_sep]*\.la\)$|\1$2\2|g"
-                       $echo "s|^$1\(/[^$_sep]*\.la[$_sep]\)|$2\1|g"
-                       $echo "s|^$1\(/[^$_sep]*\.la\)$|$2\1|g"
+                       printf "%s\n" "s|\([$_sep]\)$1\(/[^$_sep]*\.la[$_sep]\)|\1$2\2|g"
+                       printf "%s\n" "s|\([$_sep]\)$1\(/[^$_sep]*\.la[$_sep]\)|\1$2\2|g"
+                       printf "%s\n" "s|\([$_sep]\)$1\(/[^$_sep]*\.la\)$|\1$2\2|g"
+                       printf "%s\n" "s|^$1\(/[^$_sep]*\.la[$_sep]\)|$2\1|g"
+                       printf "%s\n" "s|^$1\(/[^$_sep]*\.la\)$|$2\1|g"
                        ;;
                esac
                ;;
@@ -197,16 +196,16 @@
                case $_action in
                transform)
                        $debug_log $wrapperlog "   (gen-transform) $_cmd: $@"
-                       $echo "s|^$1\([$_sep]\)|$2\1|g"
-                       $echo "s|^$1$|$2|g"
+                       printf "%s\n" "s|^$1\([$_sep]\)|$2\1|g"
+                       printf "%s\n" "s|^$1$|$2|g"
                        ;;
                untransform)
                        $debug_log $wrapperlog "   (gen-transform) $_cmd: $@"
-                       $echo "s|\([$_sep]\)$1\([$_sep]\)|\1$2\2|g"
-                       $echo "s|\([$_sep]\)$1\([$_sep]\)|\1$2\2|g"
-                       $echo "s|\([$_sep]\)$1$|\1$2|g"
-                       $echo "s|^$1\([$_sep]\)|$2\1|g"
-                       $echo "s|^$1$|$2|g"
+                       printf "%s\n" "s|\([$_sep]\)$1\([$_sep]\)|\1$2\2|g"
+                       printf "%s\n" "s|\([$_sep]\)$1\([$_sep]\)|\1$2\2|g"
+                       printf "%s\n" "s|\([$_sep]\)$1$|\1$2|g"
+                       printf "%s\n" "s|^$1\([$_sep]\)|$2\1|g"
+                       printf "%s\n" "s|^$1$|$2|g"
                        ;;
                esac
                ;;
@@ -227,16 +226,16 @@
                case $_action in
                transform)
                        $debug_log $wrapperlog "   (gen-transform) $_cmd: $@"
-                       $echo "s|^$1\(/[^$_sep]*\)$2\([$_sep]\)|$3\1$4|g"
-                       $echo "s|^$1\(/[^$_sep]*\)$2$|$3\1$4|g"
+                       printf "%s\n" "s|^$1\(/[^$_sep]*\)$2\([$_sep]\)|$3\1$4|g"
+                       printf "%s\n" "s|^$1\(/[^$_sep]*\)$2$|$3\1$4|g"
                        ;;
                untransform)
                        $debug_log $wrapperlog "   (gen-transform) $_cmd: $@"
-                       $echo "s|\([$_sep]\)$1\(/[^$_sep]*\)$2\([$_sep]\)|\1$3\2$4\3|g"
-                       $echo "s|\([$_sep]\)$1\(/[^$_sep]*\)$2\([$_sep]\)|\1$3\2$4\3|g"
-                       $echo "s|\([$_sep]\)$1\(/[^$_sep]*\)$2$|\1$3\2$4|g"
-                       $echo "s|^$1\(/[^$_sep]*\)$2\([$_sep]\)|$3\1$4|g"
-                       $echo "s|^$1\(/[^$_sep]*\)$2$|$3\1$4|g"
+                       printf "%s\n" "s|\([$_sep]\)$1\(/[^$_sep]*\)$2\([$_sep]\)|\1$3\2$4\3|g"
+                       printf "%s\n" "s|\([$_sep]\)$1\(/[^$_sep]*\)$2\([$_sep]\)|\1$3\2$4\3|g"
+                       printf "%s\n" "s|\([$_sep]\)$1\(/[^$_sep]*\)$2$|\1$3\2$4|g"
+                       printf "%s\n" "s|^$1\(/[^$_sep]*\)$2\([$_sep]\)|$3\1$4|g"
+                       printf "%s\n" "s|^$1\(/[^$_sep]*\)$2$|$3\1$4|g"
                        ;;
                esac
                ;;
@@ -282,16 +281,16 @@
                case $_action in
                transform)
                        $debug_log $wrapperlog "   (gen-transform) $_cmd: $@"
-                       $echo "s|^$1[^$_sep]*\([$_sep]\)|\1|g"
-                       $echo "s|^$1[^$_sep]*$||g"
+                       printf "%s\n" "s|^$1[^$_sep]*\([$_sep]\)|\1|g"
+                       printf "%s\n" "s|^$1[^$_sep]*$||g"
                        ;;
                untransform)
                        $debug_log $wrapperlog "   (gen-transform) $_cmd: $@"
-                       $echo "s|\([$_sep]\)$1[^$_sep]*\([$_sep]\)|\1\2|g"
-                       $echo "s|\([$_sep]\)$1[^$_sep]*\([$_sep]\)|\1\2|g"
-                       $echo "s|\([$_sep]\)$1[^$_sep]*$|\1|g"
-                       $echo "s|^$1[^$_sep]*\([$_sep]\)|\1|g"
-                       $echo "s|^$1[^$_sep]*$||g"
+                       printf "%s\n" "s|\([$_sep]\)$1[^$_sep]*\([$_sep]\)|\1\2|g"
+                       printf "%s\n" "s|\([$_sep]\)$1[^$_sep]*\([$_sep]\)|\1\2|g"
+                       printf "%s\n" "s|\([$_sep]\)$1[^$_sep]*$|\1|g"
+                       printf "%s\n" "s|^$1[^$_sep]*\([$_sep]\)|\1|g"
+                       printf "%s\n" "s|^$1[^$_sep]*$||g"
                        ;;
                esac
                ;;



Home | Main Index | Thread Index | Old Index