Source-Changes-HG archive

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

[src/trunk]: src/distrib/sets Solve [ vs. \133 in join.awk which replaces fix...



details:   https://anonhg.NetBSD.org/src/rev/8a8eb784db4c
branches:  trunk
changeset: 460481:8a8eb784db4c
user:      rhialto <rhialto%NetBSD.org@localhost>
date:      Thu Oct 24 16:52:11 2019 +0000

description:
Solve [ vs. \133 in join.awk which replaces fix in r1.23 of regpkg. Ok uki@.

diffstat:

 distrib/sets/join.awk |  15 ++++++++-------
 distrib/sets/regpkg   |  11 ++++-------
 2 files changed, 12 insertions(+), 14 deletions(-)

diffs (76 lines):

diff -r 1d253c622a33 -r 8a8eb784db4c distrib/sets/join.awk
--- a/distrib/sets/join.awk     Thu Oct 24 08:21:18 2019 +0000
+++ b/distrib/sets/join.awk     Thu Oct 24 16:52:11 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: join.awk,v 1.6 2014/10/24 22:19:44 riz Exp $
+#      $NetBSD: join.awk,v 1.7 2019/10/24 16:52:11 rhialto Exp $
 #
 # Copyright (c) 2002 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -30,7 +30,9 @@
 # join.awk F1 F2
 #      Similar to join(1), this reads a list of words from F1
 #      and outputs lines in F2 with a first word that is in F1.
-#      Neither file needs to be sorted
+#      For purposes of matching the first word, both instances are
+#      canonicalised via unvis(word); the version from F2 is printed.
+#      Neither file needs to be sorted.
 
 function unvis(s) \
 {
@@ -79,17 +81,16 @@
                exit 1
        }
        while ( (getline < ARGV[1]) > 0) {
-               $1 = unvis($1)
-               words[$1] = $0
+               f1 = unvis($1)
+               words[f1] = $0
        }
        delete ARGV[1]
 }
 
-// { $1 = unvis($1) }
+{ f1 = unvis($1) }
 
-$1 in words \
+f1 in words \
 {
-       f1=$1
        $1=""
        print words[f1] $0
 }
diff -r 1d253c622a33 -r 8a8eb784db4c distrib/sets/regpkg
--- a/distrib/sets/regpkg       Thu Oct 24 08:21:18 2019 +0000
+++ b/distrib/sets/regpkg       Thu Oct 24 16:52:11 2019 +0000
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-# $NetBSD: regpkg,v 1.23 2019/04/11 08:34:19 uki Exp $
+# $NetBSD: regpkg,v 1.24 2019/10/24 16:52:11 rhialto Exp $
 #
 # Copyright (c) 2003,2009 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -628,7 +628,7 @@
        # "@name" line and a lot of "@comment MD5:" lines.
        #
        {
-               rcsid='$NetBSD: regpkg,v 1.23 2019/04/11 08:34:19 uki Exp $'
+               rcsid='$NetBSD: regpkg,v 1.24 2019/10/24 16:52:11 rhialto Exp $'
                utcdate="$(${ENV_CMD} TZ=UTC LOCALE=C \
                        ${DATE} '+%Y-%m-%d %H:%M')"
                user="${USER:-root}"
@@ -836,11 +836,8 @@
                if [ -n "${metalog}" ]; then
                        names1="${SCRATCH}/names1"
                        names2="${SCRATCH}/names2"
-                       # There is different format between spec1 and spec2 for test(1).
-                       # spec1's format is "./bin/\133" but spec2's format is "./bin/["
-                       # XXX filtering for only '[' now
-                       ${AWK} '{print $1}' <"${spec1}" | ${SORT} | sed -e 's,\\133,\[,g' >"${names1}"
-                       ${AWK} '{print $1}' <"${spec2}" | ${SORT} | sed -e 's,\[,\\133,g' >"${names2}"
+                       ${AWK} '{print $1}' <"${spec1}" | ${SORT} >"${names1}"
+                       ${AWK} '{print $1}' <"${spec2}" | ${SORT} >"${names2}"
                        if ${FGREP} -v -f "${names2}" "${spec1}" >/dev/null
                        then
                                cat >&2 <<EOM



Home | Main Index | Thread Index | Old Index