A NOTE has been added to this issue. ====================================================================== https://austingroupbugs.net/view.php?id=1784 ====================================================================== Reported By: kre Assigned To: ====================================================================== Project: Issue 8 drafts Issue ID: 1784 Category: Shell and Utilities Type: Error Severity: Objection Priority: normal Status: Resolved Name: Robert Elz Organization: User Reference: Section: XCU 3 / getopts Page Number: 2955 - 2959 Line Number: 98803 - 98966 Final Accepted Text: See https://austingroupbugs.net/view.php?id=1784#c6600. Resolution: Accepted As Marked Fixed in Version: ====================================================================== Date Submitted: 2023-10-22 06:14 UTC Last Modified: 2023-12-14 07:05 UTC ====================================================================== Summary: getopts specification needs fixing (multiple issues) ======================================================================
---------------------------------------------------------------------- (0006607) Don Cragun (manager) - 2023-12-14 07:05 https://austingroupbugs.net/view.php?id=1784#c6607 ---------------------------------------------------------------------- Re: https://austingroupbugs.net/view.php?id=1784#c6602 <ul><li>‟The change before the final one (lines 98868...) all look to be OK to be (at least without yet considering their context, I have yet to fit them into place to see what the whole thing reads like) but that final change looks "off" to me - that is, its final sentence.” <blockquote>I am encouraged that at least the first part looks to be OK.</blockquote></li> <li>‟What does "Note that the next element of the parameter list need not exist;" mean here?” <blockquote>If you look at the changes made to lines 98806-98808, you will note that the first two bullets in the new text talk about setting <i>OPTIND</i> to be the index of the next parameter or to the next element of the parameter list. And the second bullet says "next element of the parameter list (if any; see below)". This paragraph in the OPERANDS section describing the <i>param</i> operands is the text to which "see below" refers. We should change: <blockquote>the next parameter</blockquote>in the first bullet to: <blockquote>the next element of the parameter list (if any; see below)</blockquote>and the:<blockquote>(if any; see below)</blockquote>in the second bullet should be removed to be consistent in our wording. <p>When all elements of the parameter list (either "$@" in the current shell execution environment or the <i>param</i> operands, the next element of the parameter list will not exist. In the trivial case, when the shell initializes <i>OPTIND</i> to 1 and there are no <i>param</i> operands and no positional parameters, <i>OPTIND</i> refers to an element of the parameter list that does not exist (i.e. $1 is not set).</blockquote></li> <li>‟And what relationship is $# supposed to have to the case where param operands are given?” <blockquote>Please read the entire sentence:<blockquote>Note that the next element of the parameter list need not exist; in this case, <i>OPTIND</i> will be set to <tt>$#+1</tt> or the number of <i>param</i> operands plus 1.</blockquote> I suppose we could make that more explicit with:<blockquote>... <i>OPTIND</i> will be set to $#+1 if there are no <i>param</i> opernands or to the number of <I>param</i> operands plus 1 if there are any.</blockquote> but I didn't think the extra verbosity was needed. We can change that if you think it would be better.</blockquote></li> <li>‟That text looks like it was perhaps meant to be placed elsewhere, or perhaps is an alternate version of text that was added elsewhere.” <blockquote>It is placed where we intended it to be. That section of the OPERANDS section describes how the parameter list that <i>getopts</i> will process is created from the positional parameters (the default case) or from the <i>param</i> operands if there are any. The alternative would have been to replace a few of the references to the parameter list being parsed by <i>getopts</i> with a verbose description of the appropriate positional parameter if no <i>param</i> operands were present or to the appropriate <i>param</i> operand otherwise. Doing it once where the parameter list is defined seemed to be a better choice.</blockquote></li></ul> Issue History Date Modified Username Field Change ====================================================================== 2023-10-22 06:14 kre New Issue 2023-10-22 06:14 kre Name => Robert Elz 2023-10-22 06:14 kre Section => XCU 3 / getopts 2023-10-22 06:14 kre Page Number => 2955 - 2959 2023-10-22 06:14 kre Line Number => 98803 - 98966 2023-10-22 06:40 kre Tag Attached: issue8 2023-10-28 05:08 Don Cragun Relationship added related to 0001535 2023-10-28 05:10 Don Cragun Relationship added related to 0001393 2023-10-28 05:10 Don Cragun Relationship added parent of 0000351 2023-10-28 05:19 kre Note Added: 0006555 2023-10-28 05:36 kre Note Added: 0006556 2023-10-28 06:25 Don Cragun Note Added: 0006558 2023-10-28 06:27 Don Cragun Relationship deleted related to 0001535 2023-10-28 06:28 Don Cragun Relationship deleted related to 0001393 2023-10-28 06:34 Don Cragun Relationship deleted parent of 0000351 2023-10-28 06:34 kre Note Edited: 0006556 2023-11-13 18:09 shware_systems Note Added: 0006568 2023-11-13 20:16 kre Note Added: 0006569 2023-11-14 09:44 geoffclare Tag Detached: issue8 2023-11-15 22:23 salewski Issue Monitored: salewski 2023-12-11 17:37 geoffclare Note Added: 0006598 2023-12-11 17:41 Don Cragun Note Added: 0006599 2023-12-11 17:50 Don Cragun Note Added: 0006600 2023-12-11 17:55 Don Cragun Note Edited: 0006600 2023-12-11 17:58 Don Cragun Note Edited: 0006600 2023-12-11 17:59 Don Cragun Status New => Resolved 2023-12-11 17:59 Don Cragun Resolution Open => Accepted As Marked 2023-12-11 18:01 Don Cragun Final Accepted Text => See https://austingroupbugs.net/view.php?id=1784#c6600. 2023-12-11 18:02 Don Cragun Tag Attached: issue8 2023-12-11 19:22 Don Cragun Note Deleted: 0006599 2023-12-11 23:41 kre Note Added: 0006602 2023-12-11 23:42 kre Note Edited: 0006602 2023-12-11 23:52 kre Note Added: 0006603 2023-12-12 09:25 geoffclare Note Added: 0006604 2023-12-12 09:25 geoffclare Note Edited: 0006604 2023-12-12 21:22 kre Note Added: 0006606 2023-12-14 07:05 Don Cragun Note Added: 0006607 ======================================================================