View Issue Details

IDProjectCategoryView StatusLast Update
00015811003.1(2016/18)/Issue7+TC2Shell and Utilitiespublic2022-05-05 15:39
Reportermirabilos Assigned To 
PrioritynormalSeverityEditorialTypeClarification Requested
Status ClosedResolutionDuplicate 
Namemirabilos
OrganizationMirBSD
User Reference
Section2.4
Page Number(page or range of pages)
Line Number(Line or range of lines)
Interp Status---
Final Accepted Text
Summary0001581: “time” vs. Korn Shell flavours
DescriptionPOSIX currently makes allowances for the Korn Shell flavour of “time” in https://pubs.opengroup.org/onlinepubs/9699919799/utilities/time.html where certain grouping options are unspecified (because “time a | b” in some Korn Shell flavours times the pipeline, not the command “a”).

However, a user reported something that makes the support for this flavour of “time” incomplete: the inability to define a function called “time”.

They can, just not without a backslash, same for using it:

$ function time { echo bar; }
$ time echo foo
foo
    0m00.00s real 0m00.00s user 0m00.00s system
$ \time echo foo
bar
$ time() { echo meh; }
E: /bin/mksh: syntax error: unexpected '{'
$ \time() { echo baz; }
$ \time echo foo
baz

This is because “time” is a keyword, to achieve the aforementioned (and already POSIX-sanctioned) effect.

The user complaint is because “The function is named fname; the application shall ensure that it is a name (see XBD [194]Name) and that it is not the name of a special built-in utility.” (2.9.5) leads to them thinking they can define a function called “time” because “time” is not a special builtin.

The Desired Action, I believe, matches the spirit of the current sanctioning of this behaviour in the “time” utility description by adding “time” to the list of the words that may sometimes be reserved words, making it clear that, yes, the user _can_ define and call a function named “time”, just not as first word on the command line without quoting. It would also not require any change to any implementation.
Desired ActionIn XSH section 2.4, around line 76309 in the slightly old PDF I have here, add “time” to the list of “words that may be recognised as reserved words on some implementations (when none of the characters are quoted)”.
TagsNo tags attached.

Relationships

duplicate of 0000267 Closedajosey 1003.1(2004)/Issue 6 time (keyword) 

Activities

geoffclare

2022-04-26 16:10

manager   bugnote:0005823

This is a duplicate of bug 0000267

Issue History

Date Modified Username Field Change
2022-04-26 15:51 mirabilos New Issue
2022-04-26 15:51 mirabilos Name => mirabilos
2022-04-26 15:51 mirabilos Organization => MirBSD
2022-04-26 15:51 mirabilos URL => https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_04
2022-04-26 15:51 mirabilos Section => 2.4
2022-04-26 16:10 geoffclare Project Online Pubs => 1003.1(2016/18)/Issue7+TC2
2022-04-26 16:10 geoffclare Note Added: 0005823
2022-04-26 16:10 geoffclare Relationship added duplicate of 0000267
2022-05-05 15:39 geoffclare Page Number => (page or range of pages)
2022-05-05 15:39 geoffclare Line Number => (Line or range of lines)
2022-05-05 15:39 geoffclare Interp Status => ---
2022-05-05 15:39 geoffclare Status New => Closed
2022-05-05 15:39 geoffclare Resolution Open => Duplicate