From 0f5caf14a3124c24f38f340fd6504532f07d9617 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 24 Dec 2018 14:19:47 -0500 Subject: ob_parse_dep(), ob_reduce_deps(): Initialize OPTIND before getopts Dash and BusyBox ash apparently do this themselves, but GNU Bash (and other shells?) don't. POSIX says that getopts can be used more than once if OPTIND is set to 1, but using getopts multiple times with different parameters without setting OPTIND to 1 "produces unspecified results". --- diff --git a/lib/deps.sh b/lib/deps.sh index 167c41b..760a529 100644 --- a/lib/deps.sh +++ b/lib/deps.sh @@ -39,6 +39,7 @@ ob_parse_dep() local comp= local comp_var= + OPTIND=1 while getopts 'p:q:r:v:A:l:a:P:' opt; do case "${opt}" in p) @@ -163,6 +164,7 @@ ob_reduce_deps() union='false' + OPTIND=1 while getopts 'a:P:u' opt; do case "${opt}" in a) -- cgit v0.9.1