A NOTE has been added to this issue. ====================================================================== https://austingroupbugs.net/view.php?id=267 ====================================================================== Reported By: Don Cragun Assigned To: ajosey ====================================================================== Project: 1003.1(2004)/Issue 6 Issue ID: 267 Category: Shell and Utilities Type: Clarification Requested Severity: Objection Priority: normal Status: Under Review Name: Don Cragun Organization: User Reference: Section: time Page Number: 916-919 Line Number: 35505-35633 Interp Status: --- Final Accepted Text: WAS https://austingroupbugs.net/view.php?id=267#c442 and https://austingroupbugs.net/view.php?id=267#c1692 ====================================================================== Date Submitted: 2010-06-25 16:19 UTC Last Modified: 2022-10-07 15:56 UTC ====================================================================== Summary: time (keyword) ====================================================================== Relationships ID Summary ---------------------------------------------------------------------- related to 0000789 Add set -o pipefail has duplicate 0001051 stderr redirection of the "time&qu... has duplicate 0001581 “time” vs. Korn Shell flavours related to 0000723 time is not allowed to write error mess... ======================================================================
---------------------------------------------------------------------- (0005990) geoffclare (manager) - 2022-10-07 15:56 https://austingroupbugs.net/view.php?id=267#c5990 ---------------------------------------------------------------------- Suggested changes ... (I used https://austingroupbugs.net/view.php?id=267#c4794 as a starting point, but the differences are not just editorial.) On D2.1 page 2314 line 74522 section 2.4, change:<blockquote>The following words may be recognized as reserved words on some implementations (when none of the characters are quoted), causing unspecified results:</blockquote>to:<blockquote>When used in circumstances where reserved words are recognized (described above), the following words may be recognized as reserved words, in which case the results are unspecified except as described below for <b>time</b>:</blockquote> On D2.1 page 2314 line 74524 section 2.4, after <b>select</b> add <b>time</b>. After D2.1 page 2314 line 74524 section 2.4, add a new paragraph:<blockquote>When the word <b>time</b> is recognized as a reserved word in circumstances where it would, if it were not a reserved word, be the command name (see [xref to 2.9.1.1]) of a simple command that would execute the <i>time</i> utility in a manner other than one for which [xref to time] states that the results are unspecified, the behavior shall be as specified for the <i>time</i> utility.</blockquote> On D2.1 page 2314 line 74525 section 2.4, change:<blockquote>Words that are the concatenation of a name and a <colon> (':') are reserved; their use produces unspecified results.</blockquote>to:<blockquote>When used in circumstances where reserved words are recognized (described above), all words whose final character is a <colon> (':') are reserved; their use in those circumstances produces unspecified results.</blockquote> On D2.1 page 3215 line 109183 section time, change:<blockquote>When <i>time</i> is used as part of a pipeline, the times reported are unspecified, except when it is the sole command within a grouping command (see [xref to 2.9.4.1]) in that pipeline. For example, the commands on the left are unspecified; those on the right report on utilities <b>a</b> and <b>c</b>, respectively:<pre>time a | b | c { time a; } | b | c a | b | time c a | b | (time c)</pre></blockquote>to:<blockquote>When <i>time</i> is used in any of the following circumstances, via a simple command for which the word <b>time</b> is the command name (see [xref to 2.9.1.1]), and none of the characters in the word <b>time</b> is quoted, the results (including parsing of later words) are unspecified: <ul> <li>The simple command for which the word <b>time</b> is the command name includes one or more redirections (see [xref to 2.7]) or is (directly) part of a pipeline (see [xref to 2.9.2]).</li> <li>The next word that follows <b>time</b> would, if the word <b>time</b> were not present, be recognized as a reserved word (see [xref to 2.4]) or a control operator (see [xref to XBD 3.83]).</li> <li>The <i>utility</i> operand names a special built-in utility (see [xref to 2.14]), an intrinsic utility (see [xref to 1.7]), or a function (see [xref to 2.9.5]).</li> </ul> Since these limitations only apply when <i>time</i> is executed via a simple command for which the word <b>time</b> is the command name and none of the characters in the word <b>time</b> is quoted, they can be avoided by quoting all or part of the word <b>time</b>, by arranging for the command name not to be <b>time</b> (for example, by having the command name be a word expansion), or by executing <i>time</i> via another utility such as <i>command</i> or <i>env</i>. The limitations on redirections and pipelines can also be overcome by embedding the simple command within a compound command--most commonly a grouping command (see [xref to 2.9.4.1])--and applying the redirections or piping to the compound command instead. Note that in no circumstances where the results are specified is it possible to apply different redirections to the <i>time</i> utility than are applied to the utility it invokes. The following examples (where <i>a</i> and <i>b</i> are assumed to be the names of utilities found by searching <i>PATH</i>) show unspecified usages:<pre>time a arg1 arg2 | b # part of a pipeline a | time -p b # part of a pipeline time a >/dev/null # output redirection </dev/null time a # input redirection time while anything... # reserved word after <b>time</b> time ( cmd ) # control operator after <b>time</b> time; # control operator after <b>time</b> time shift # special built-in utility time -p cd / # intrinsic utility</pre> The following examples have specified results and can be used as alternatives for the first four of the above when the <i>time</i> utility as specified here is intended to be invoked:<pre>{ time a arg1 arg2; } | b t=time; a | $t -p b command time a >/dev/null </dev/null \time a</pre></blockquote> On D2.1 page 3215 line 109196 section time, delete:<blockquote>If the <i>utility</i> operand names any of the special built-in utilities in [xref to 2.14], the results are undefined.</blockquote> On D2.1 page 3621 line 125120 section C.2.4, change:<blockquote>This list contained <b>time</b> in early proposals, but it was removed when the <i>time</i> utility was selected for the Shell and Utilities volume of POSIX.1-202x.</blockquote>to:<blockquote>Earlier versions of this standard omitted <b>time</b> from this list, so that the <i>time</i> utility could be included without requiring applications to quote all or part of its name (or use other measures) in order to avoid it being treated as a reserved word. However, although the intent was to allow the reserved word implementation (as evidenced by use of <i>time</i> in pipelines being unspecified, and explicit mention in the rationale of the <i>time</i> utility), the conditions under which the behavior was unspecified were insufficient to allow this. In particular, redirection in KornShell does not work in the normal way when <b>time</b> is a reserved word:<pre>time utility 2> time.out</pre>only writes the standard error from <i>utility</i> to <b>time.out</b>; the timing information is written to the shell's standard error, but these versions of the standard required the timing information to be written to <b>time.out</b>. Another issue was that if <b>time</i> is a reserved word, an application cannot define a function with that name, but these versions of the standard required that applications could do so. Hence <b>time</b> has now been added to the list of unspecified reserved words, but with its use as a reserved word limited in order to be compatible with its use as a utility in the cases where the two have traditionally had the same effect (other than possible output format differences).</blockquote> On D2.1 page 3621 line 125128 section C.2.4, change:<blockquote>The restriction on ending a name with a <colon> is to allow future implementations that support named labels for flow control; see the RATIONALE for the <i>break</i> built-in utility.</blockquote>to:<blockquote>When used in circumstances where reserved words are recognized, all words whose final character is a <colon> (':') are reserved. The case of a name suffixed with a colon is reserved to allow implementations to support named labels for flow control; see the RATIONALE for the <i>break</i> special built-in utility. Other words ending in <colon> are reserved to provide implementations with a way to add new reserved words while still conforming to this standard.</blockquote> Issue History Date Modified Username Field Change ====================================================================== 2010-06-25 16:19 geoffclare New Issue 2010-06-25 16:19 geoffclare Status New => Under Review 2010-06-25 16:19 geoffclare Assigned To => ajosey 2010-06-25 16:19 geoffclare Name => Don Cragun 2010-06-25 16:19 geoffclare Section => time 2010-06-25 16:19 geoffclare Page Number => 916-919 2010-06-25 16:19 geoffclare Line Number => 35505-35633 2010-06-25 16:19 geoffclare Interp Status => --- 2010-06-25 16:20 geoffclare Note Added: 0000437 2010-06-25 16:20 geoffclare Reporter geoffclare => Don Cragun 2010-06-26 17:52 geoffclare Note Added: 0000442 2010-06-26 17:54 geoffclare Interp Status --- => Pending 2010-06-26 17:54 geoffclare Final Accepted Text => https://austingroupbugs.net/view.php?id=267#c442 2010-06-26 17:54 geoffclare Status Under Review => Interpretation Required 2010-06-26 17:54 geoffclare Resolution Open => Accepted As Marked 2010-07-30 08:19 ajosey Interp Status Pending => Proposed 2010-07-30 08:19 ajosey Note Added: 0000493 2010-09-03 16:38 ajosey Interp Status Proposed => Approved 2013-07-16 15:20 geoffclare Relationship added related to 0000723 2013-08-01 15:13 geoffclare Note Added: 0001692 2013-08-01 15:14 geoffclare Final Accepted Text https://austingroupbugs.net/view.php?id=267#c442 => https://austingroupbugs.net/view.php?id=267#c442 and https://austingroupbugs.net/view.php?id=267#c1692 2013-08-01 15:15 geoffclare Note Edited: 0001692 2016-05-04 15:10 geoffclare Relationship added related to 0001051 2016-05-04 18:21 shware_systems Tag Attached: issue8 2016-05-05 22:18 stephane Note Added: 0003199 2016-05-05 22:19 stephane Note Edited: 0003199 2016-05-06 07:46 stephane Note Edited: 0003199 2016-05-09 10:06 joerg Note Added: 0003202 2016-05-11 11:38 stephane Note Added: 0003209 2016-05-11 11:57 joerg Note Added: 0003210 2016-05-11 11:58 joerg Note Edited: 0003210 2016-05-11 11:59 joerg Note Edited: 0003210 2016-05-11 12:31 stephane Note Added: 0003211 2016-05-11 12:47 joerg Note Added: 0003212 2016-05-11 12:47 joerg Note Edited: 0003212 2016-05-11 12:49 joerg Note Edited: 0003212 2016-05-11 13:14 stephane Note Added: 0003213 2016-05-11 13:28 joerg Note Added: 0003214 2016-05-11 13:28 joerg Note Edited: 0003214 2016-05-11 13:42 stephane Note Edited: 0003211 2016-05-11 13:43 joerg Note Edited: 0003210 2017-06-08 15:08 geoffclare Relationship replaced has duplicate 0001051 2020-02-06 10:01 geoffclare Interp Status Approved => --- 2020-02-06 10:01 geoffclare Final Accepted Text https://austingroupbugs.net/view.php?id=267#c442 and https://austingroupbugs.net/view.php?id=267#c1692 => WAS https://austingroupbugs.net/view.php?id=267#c442 and https://austingroupbugs.net/view.php?id=267#c1692 2020-02-06 10:01 geoffclare Note Added: 0004771 2020-02-06 10:01 geoffclare Status Interpretation Required => Under Review 2020-02-06 10:01 geoffclare Resolution Accepted As Marked => Reopened 2020-02-06 10:01 geoffclare Tag Detached: issue8 2020-02-06 10:02 geoffclare Relationship added related to 0000789 2020-03-06 07:18 kre Note Added: 0004794 2020-03-06 07:21 kre Note Added: 0004795 2020-03-06 07:23 kre Note Edited: 0004795 2020-03-06 07:32 kre Note Edited: 0004795 2022-04-26 16:10 geoffclare Relationship added has duplicate 0001581 2022-04-26 16:30 mirabilos Note Added: 0005824 2022-10-07 15:56 geoffclare Note Added: 0005990 ======================================================================