Pull up following revision(s) (requested by kre in ticket #632):

distrib/miniroot/install.sub: revision 1.52

The idiom

	set $whatever
	while [ $# - gt 10 ]; do shift 10; done
	eval echo \$$#

fails when $# turns out to be 10 (or any multiple), it would need
to be instead

	while [ $# -ge 10 ]; do shift 9; done

but there hasn't been a shell that cannot handle ${10} (etc) correctly
in a very long time, so let's just use that instead (properly quoted,
in case IFS happens to contain a digit for some bizarre reason).

We should also "set -f" / "set +f" (or better, restore the prev setting of -f)
around the "set $whatever" part, but if that was ever going to cause a problem
here, it would have already, so leave that for now.
This commit is contained in:
martin 2020-01-21 15:26:46 +00:00
parent 9c54512d3b
commit ba72500e05
1 changed files with 3 additions and 5 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $NetBSD: install.sub,v 1.48.2.2 2020/01/21 11:30:28 martin Exp $
# $NetBSD: install.sub,v 1.48.2.3 2020/01/21 15:26:46 martin Exp $
#
# Copyright (c) 1996 The NetBSD Foundation, Inc.
# All rights reserved.
@ -114,8 +114,7 @@ cutlast () {
read _a; set -- $_a
IFS="$_oifs"
if [ "$1" = "" ]; then return; fi
while [ "$#" -gt 10 ]; do shift 10; done
eval echo \$$#
eval echo '"${'"$#"'}"'
}
firstchar () {
@ -135,8 +134,7 @@ basename () {
IFS="/"
set -- $1
IFS="$_oifs"
while [ "$#" -gt 10 ]; do shift 10; done
eval echo \$$#
eval echo '"${'"$#"'}"'
}
dir_has_sets() {