From d9b045b4e06bbf3a1fce2bd078993c013cc9dc33 Mon Sep 17 00:00:00 2001 From: kn Date: Sat, 1 Apr 2023 23:24:46 +0000 Subject: [PATCH] Limit IFS scope to effect parsing code only Set to split `hw.disknames' strings is neat, but functionn-wide means the bsort() invocation honours it, i.e. it'll output newlines not spaces. Break the one-liner into the same multi-line idom occuring elsewhere and contain IFS in the subshell that needs it. This was never visible due how the output of was consumed by the shell. The only visual, but otherwise effectless bug due to this appeared with the new disk encryption question double-quoting get_dkdevs() output, i.e. multiple disks printed across multiple lines; this yields one, as inteded. OK afresh1 --- distrib/miniroot/install.sub | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 537a9ae3612..71496e89326 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: install.sub,v 1.1237 2023/03/29 17:40:24 kn Exp $ +# $OpenBSD: install.sub,v 1.1238 2023/04/01 23:24:46 kn Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer @@ -297,9 +297,10 @@ scan_dmesg() { # Extract device names from hw.disknames matching sed expression $1. scan_disknames() { - local IFS=, _disks=$(sysctl -n hw.disknames) - - bsort $(for _n in $_disks; do echo "${_n%%:*} "; done | sed -n "$1") + bsort $(IFS=, + for _d in $(sysctl -n hw.disknames); do + echo "${_d%%:*} " + done | sed -n "$1") } # Return list of disks with softraid chunks, optionally limited to the volume $1. -- 2.20.1