From 5ed0f3610c276dbd81de5057f9dab92a467fb632 Mon Sep 17 00:00:00 2001 From: tcottier Date: Fri, 28 Oct 2016 20:18:56 +0200 Subject: [PATCH] When getopts is called multiple time we need to reset OPTIND. (#3475) Not resetting OPTIND between each call of getopts skips all short args except the first one. It fixes this automated command: ./certbot-auto certonly --webroot -w /tmp -d example.com --agree-tos --email contact@example.com -n Where "-w" was parsed by getopts and not "-n" * When getopts is called multiple time we need to reset OPTIND. Issue #3459 * Adding OPTIND reset in the certbot-auto source file * Building new letsencrypt-auto from template --- letsencrypt-auto-source/letsencrypt-auto | 1 + letsencrypt-auto-source/letsencrypt-auto.template | 1 + 2 files changed, 2 insertions(+) diff --git a/letsencrypt-auto-source/letsencrypt-auto b/letsencrypt-auto-source/letsencrypt-auto index 4ec226d39..58e00931a 100755 --- a/letsencrypt-auto-source/letsencrypt-auto +++ b/letsencrypt-auto-source/letsencrypt-auto @@ -58,6 +58,7 @@ for arg in "$@" ; do --verbose) VERBOSE=1;; -[!-]*) + OPTIND=1 while getopts ":hnvq" short_arg $arg; do case "$short_arg" in h) diff --git a/letsencrypt-auto-source/letsencrypt-auto.template b/letsencrypt-auto-source/letsencrypt-auto.template index 991d9dd76..2ac8d8d79 100755 --- a/letsencrypt-auto-source/letsencrypt-auto.template +++ b/letsencrypt-auto-source/letsencrypt-auto.template @@ -58,6 +58,7 @@ for arg in "$@" ; do --verbose) VERBOSE=1;; -[!-]*) + OPTIND=1 while getopts ":hnvq" short_arg $arg; do case "$short_arg" in h)