Date: Mon, 1 Sep 2014 22:53:47 +0000 (UTC) From: Devin Teske <dteske@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270954 - head/usr.sbin/bsdconfig/share Message-ID: <201409012253.s81MrlHL018627@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409012253.s81MrlHL018627>