A NOTE has been added to this issue. ====================================================================== http://austingroupbugs.net/view.php?id=1075 ====================================================================== Reported By: Don Cragun Assigned To: ====================================================================== Project: 1003.1(2013)/Issue7+TC1 Issue ID: 1075 Category: Shell and Utilities Type: Omission Severity: Objection Priority: normal Status: Resolved Name: Donald Cragun Organization: Self User Reference: Section: 2.14 Special Built-in Utilities -- unset Page Number: 2395 Line Number: 76338-76355 Interp Status: --- Final Accepted Text: Resolution: Accepted Fixed in Version: ====================================================================== Date Submitted: 2016-09-08 20:08 UTC Last Modified: 2018-03-08 21:42 UTC ====================================================================== Summary: The unset utility's NAME section mentions values and attributes, but the DESCRIPTION doesn't mention attributes. ======================================================================
---------------------------------------------------------------------- (0003931) kre (reporter) - 2018-03-08 21:42 http://austingroupbugs.net/view.php?id=1075#c3931 ---------------------------------------------------------------------- I had not seen this issue earlier... I do not much like the resolution approved, as it suggests that "unset" can undo the readonly attribute, which has never been one of its functions. The text does say that Read-only variables cannot be unset. but it does not say (explicitly) that the readonly attribute cannot be removed - and if the text is not to say and unset any attributes that have been given to name (see section 2.14 export and readonly). It reads to me as if it is saying that unset should be able to unset the readonly attribute, and there is nothing that counters that. The text as it currently exists (in TC2) says ... If -v is specified, name refers to a variable name and the shell shall unset it and remove it from the environment. I have always interpreted "remove it from the environment" as including "delete the export attribute" as if that were not to happen, the variable would simply reappear in the environment when it is set again, and that is not what any shell has ever done. I agree that this section is not well written, and needs clarification (particularly in that if -v is not specified, all it says is that the variable should be unset - which could allow an implementation to leave the value in the environment while deleting it from the current shell, which is also not what should happen.) So, I would suggest that the text should say something more like If -f is set, each name refers to a function, and affects the named functions. If -v is set, each name refers to a variable, and affects the named variables. If both -f and -v are set, then both variables and functions are affected. If neither -f nor -v is specified, name refers to a variable; if a variable by that name does not exist, it is unspecified whether a function by that name, if any, is affected. Each variable to be operated upon by this command shall be unset, removed from the environment, and have its export attribute (see the export command in section 2.14) removed. Read-only variables (see the readonly command in section 2.14) cannot be unset, and are not altered in any way. Each function to be operated upon by this command shall have its definition deleted (the function shall be unset) so that no function of that name continues to exist in the current execution environment. Unsetting a variable or function that was not previously set shall not be considered an error and does not cause the shell to abort. (and the rest that currently follows the previous sentence, which is unchanged.) There should probably be something added related to attempts to unset readonly variables causing an error (at least exit status 1, and a diagnostic to stderr). Issue History Date Modified Username Field Change ====================================================================== 2016-09-08 20:08 Don Cragun New Issue 2016-09-08 20:08 Don Cragun Name => Donald Cragun 2016-09-08 20:08 Don Cragun Organization => Self 2016-09-08 20:08 Don Cragun Section => 2.14 Special Built-in Utilities -- unset 2016-09-08 20:08 Don Cragun Page Number => 2395 2016-09-08 20:08 Don Cragun Line Number => 76338-76355 2016-09-08 20:08 Don Cragun Interp Status => --- 2018-03-08 16:20 geoffclare Status New => Resolved 2018-03-08 16:20 geoffclare Resolution Open => Accepted 2018-03-08 16:20 geoffclare Tag Attached: tc3-2008 2018-03-08 21:42 kre Note Added: 0003931 ======================================================================
