From owner-svn-src-head@FreeBSD.ORG Mon Sep 1 22:53:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D97D4D2A; Mon, 1 Sep 2014 22:53:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C56581D66; Mon, 1 Sep 2014 22:53:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s81MrlOu018628; Mon, 1 Sep 2014 22:53:47 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s81MrlHL018627; Mon, 1 Sep 2014 22:53:47 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201409012253.s81MrlHL018627@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Mon, 1 Sep 2014 22:53:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270954 - head/usr.sbin/bsdconfig/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Sep 2014 22:53:48 -0000 Author: dteske Date: Mon Sep 1 22:53:47 2014 New Revision: 270954 URL: http://svnweb.freebsd.org/changeset/base/270954 Log: Fix a bug where command line arguments could be misprocessed if getopts is used prior to f_dialog_init() -- e.g., in a script that sets DIALOG_SELF_INITIALIZE to NULL, preventing f_dialog_init() from being run automaticaly when `dialog.subr' is included. Caused by sub-shell processing of arguments inheriting prior value of $OPTIND, used by getopts. Solved by unsetting OPTIND prior to [re-]processing of positional arguments. Modified: head/usr.sbin/bsdconfig/share/dialog.subr Modified: head/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/dialog.subr Mon Sep 1 22:40:31 2014 (r270953) +++ head/usr.sbin/bsdconfig/share/dialog.subr Mon Sep 1 22:53:47 2014 (r270954) @@ -2116,6 +2116,7 @@ f_dialog_init() f_dprintf "f_dialog_init: ARGV=[%s] GETOPTS_STDARGS=[%s]" \ "$ARGV" "$GETOPTS_STDARGS" SECURE=`set -- $ARGV + unset OPTIND while getopts \ "$GETOPTS_STDARGS$GETOPTS_EXTRA$GETOPTS_ALLFLAGS" \ flag > /dev/null; do @@ -2125,6 +2126,7 @@ f_dialog_init() done ` # END-BACKTICK USE_XDIALOG=`set -- $ARGV + unset OPTIND while getopts \ "$GETOPTS_STDARGS$GETOPTS_EXTRA$GETOPTS_ALLFLAGS" \ flag > /dev/null; do