Source-Changes-HG archive

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

[src/trunk]: src/distrib/sets Fix annotation checksum in +CONTENTS of syspkg



details:   https://anonhg.NetBSD.org/src/rev/93d1fd5f079a
branches:  trunk
changeset: 373445:93d1fd5f079a
user:      uki <uki%NetBSD.org@localhost>
date:      Sat Feb 11 04:16:57 2023 +0000

description:
Fix annotation checksum in +CONTENTS of syspkg

- Fix bug that file in DESTDIR is not referenced correctly.
- Change checksum algorithm to SHA256 from MD5.
- Remove invalid option of cksum(1) in regpkg.

diffstat:

 distrib/sets/regpkg |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (42 lines):

diff -r f49f5abb8101 -r 93d1fd5f079a distrib/sets/regpkg
--- a/distrib/sets/regpkg       Sat Feb 11 02:52:52 2023 +0000
+++ b/distrib/sets/regpkg       Sat Feb 11 04:16:57 2023 +0000
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-# $NetBSD: regpkg,v 1.25 2021/10/18 10:47:44 uki Exp $
+# $NetBSD: regpkg,v 1.26 2023/02/11 04:16:57 uki 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.25 2021/10/18 10:47:44 uki Exp $'
+               rcsid='$NetBSD: regpkg,v 1.26 2023/02/11 04:16:57 uki Exp $'
                utcdate="$(${ENV_CMD} TZ=UTC LOCALE=C \
                        ${DATE} '+%Y-%m-%d %H:%M')"
                user="${USER:-root}"
@@ -665,16 +665,15 @@
                                ;;
                        *)      
                                # This should be a file name.  Pass it
-                               # through, and append "@comment MD5:".
-                               # XXX why not SHA256 ?
+                               # through, and append "@comment SHA256:".
                                echo "${line}"
-                               file="${DESTDIR}${line}"
-                               if [ -f "${file}" -a -r "${file}" ];
+                               file="${DESTDIR}/${line}"
+                               if [ -f "${file}" ] && [ -r "${file}" ];
                                then
-                                       md5sum="$(${CKSUM} -n -m "${file}" \
+                                       sha256sum="$(${CKSUM} -a sha256 -n "${file}" \
                                                   | ${AWK} '{print $1}'
                                                )"
-                                       echo "@comment MD5:${md5sum}"
+                                       echo "@comment SHA256:${sha256sum}"
                                fi
                                ;;
                        esac



Home | Main Index | Thread Index | Old Index