pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/pkginstall Work around a potential shell bug where ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/eda998d2225f
branches:  trunk
changeset: 427353:eda998d2225f
user:      sborrill <sborrill%pkgsrc.org@localhost>
date:      Wed Apr 15 13:33:32 2020 +0000

description:
Work around a potential shell bug where "${FOO=${BAR%/*}}" does not work
if quoted. Seen on NetBSD 7.

#!/bin/sh
in="/path/to/dir with space/file"

: "${file=${in##*/}}"
: "${dir=${in%/*}}"
echo "dir:$dir"
echo "file:$file"
[ "$dir" = "$file" ] && echo "dir and file are same"

Leads to errors when adding packages such as:
./+FILES: cannot create /var/db/pkg.refcount/files/etc/rc.d/xenguest//var/db/pkg/xe-guest-utilities-7.0.0: directory nonexistent

diffstat:

 mk/pkginstall/files |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (20 lines):

diff -r d9839ef34f80 -r eda998d2225f mk/pkginstall/files
--- a/mk/pkginstall/files       Wed Apr 15 13:01:06 2020 +0000
+++ b/mk/pkginstall/files       Wed Apr 15 13:33:32 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.10 2020/02/11 01:21:25 rillig Exp $
+# $NetBSD: files,v 1.11 2020/04/15 13:33:32 sborrill Exp $
 #
 # Generate a +FILES script that reference counts config files that are
 # required for the proper functioning of the package.
@@ -98,8 +98,8 @@
 
 CURDIR=`${PWD_CMD}`
 PKG_METADATA_DIR="${2-${CURDIR}}"
-: "${PKGNAME=${PKG_METADATA_DIR##*/}}"
-: "${PKG_DBDIR=${PKG_METADATA_DIR%/*}}"
+: ${PKGNAME="${PKG_METADATA_DIR##*/}"}
+: ${PKG_DBDIR="${PKG_METADATA_DIR%/*}"}
 : "${PKG_REFCOUNT_DBDIR=${PKG_DBDIR}.refcount}"
 PKG_REFCOUNT_FILES_DBDIR="${PKG_REFCOUNT_DBDIR}/files"
 



Home | Main Index | Thread Index | Old Index