A NOTE has been added to this issue. ====================================================================== http://austingroupbugs.net/view.php?id=1161 ====================================================================== Reported By: steffen Assigned To: ====================================================================== Project: 1003.1(2016)/Issue7+TC2 Issue ID: 1161 Category: Shell and Utilities Type: Clarification Requested Severity: Editorial Priority: normal Status: Resolved Name: steffen Organization: User Reference: Section: command Page Number: 2596 Line Number: 84274 ff. Interp Status: --- Final Accepted Text: See http://austingroupbugs.net/view.php?id=1161#c4220 Resolution: Accepted As Marked Fixed in Version: ====================================================================== Date Submitted: 2017-09-04 13:09 UTC Last Modified: 2019-01-25 02:58 UTC ====================================================================== Summary: command -v must find something executable ====================================================================== Relationships ID Summary ---------------------------------------------------------------------- related to 0001226 shell can not test if a file is text ======================================================================
---------------------------------------------------------------------- (0004229) kre (reporter) - 2019-01-25 02:58 http://austingroupbugs.net/view.php?id=1161#c4229 ---------------------------------------------------------------------- One additional note: In note 3852 Chet attempted to answer the "why does it exist at all" issue with a pointer to the Rationale. That tells us why it was added by posix "Users liked which/whence/type and demanded something like that" but not what it is supposed to be useful for, its purpose, without knowing which we cannot possibly write text which says how it is expected to work. If the purpose is to solve the problem: User: "I said foo, but something happened that I did not expect, the foo command I thought would run did not, which I verified by ...." then the proposed wording in note 4224 would not be adequate, as if the shell's first exec attempt fails, it might go to make another, which succeeds - telling the user the path name of the first attempt (which might be the command the user is expecting to be run) is useless. A better solution to that problem would be something that indicates what pathname was last successfully used for an exec, so the user could say "foo" have it fail, then use the "what-happened-there" command to find out what was just executed. Of course, this would be pure invention, and so not suitable to be defined here. This is also an issue where only a human needs the output, so command -V is a better choice than -v anyway. On the other hand, I have had need to determine whether a command is built into the shell. For this, command -v is useless, as it produces the same output for functions and builtins, and in the case in question, while there might have been a function existing, that would not have been relevant (the command in question was too complex to be implemented entirely as a function ... so such a function, if it wasn't doing something else entirely different, would need to either invoke a builtin, or filesystem version to do the real work ... and which of those would happen is what would need discovering). I had to resort to type (or command -V) which are essentially the same, and just hope that shells would report builtin commands using something I could guess at and match. The are likely many other potential uses, but until we know what they are, we cannot know if the specification is adequate to meet them. Really nothing should have been added to meet the apparent user demand without answering this question first, which the rationale acknowledges did not happen: Since there is no historical agreement on how and what to accomplish here, the POSIX command utility was enhanced ... which is just saying "we don't know what we're doing, or why, but we're going to do it anyway" but it is too late to worry about that now. But something needs to be done, as it is now it is all worse than useless. The proposed resolution does not help. Issue History Date Modified Username Field Change ====================================================================== 2017-09-04 13:09 steffen New Issue 2017-09-04 13:09 steffen Name => steffen 2017-09-04 13:09 steffen Section => command 2017-09-04 13:09 steffen Page Number => 2596 2017-09-04 13:09 steffen Line Number => 84274 ff. 2017-09-04 15:49 kre Note Added: 0003821 2017-09-05 06:58 stephane Note Added: 0003823 2017-09-05 08:30 stephane Note Added: 0003824 2017-09-05 12:34 steffen Note Added: 0003825 2017-09-05 12:39 steffen Note Added: 0003826 2017-09-05 12:47 kre Note Added: 0003827 2017-09-05 13:37 steffen Note Added: 0003828 2017-09-05 15:37 chet_ramey Note Added: 0003829 2017-09-05 15:41 stephane Note Added: 0003830 2017-09-05 16:01 stephane Note Added: 0003831 2017-09-05 16:36 stephane Note Added: 0003832 2017-09-05 17:30 stephane Note Added: 0003833 2017-09-05 20:17 steffen Note Added: 0003834 2017-09-05 20:19 steffen Note Added: 0003835 2017-09-05 20:27 kre Note Added: 0003836 2017-09-05 20:29 chet_ramey Note Added: 0003837 2017-09-05 21:27 eblake Note Added: 0003838 2017-09-05 21:50 kre Note Added: 0003839 2017-09-05 21:52 kre Note Edited: 0003839 2017-09-05 22:21 eblake Note Added: 0003840 2017-09-05 22:23 Don Cragun Note Added: 0003841 2017-09-05 22:24 Don Cragun Note Deleted: 0003841 2017-09-06 00:00 kre Note Added: 0003842 2017-09-06 00:00 kre Note Deleted: 0003839 2017-09-06 08:30 stephane Note Added: 0003843 2017-09-06 08:32 stephane Note Edited: 0003843 2017-09-06 09:30 stephane Note Added: 0003844 2017-09-06 09:37 stephane Note Added: 0003845 2017-09-06 09:50 joerg Note Added: 0003846 2017-09-06 09:50 joerg Note Edited: 0003846 2017-09-06 09:50 joerg Note Edited: 0003846 2017-09-06 09:54 stephane Note Edited: 0003845 2017-09-06 12:55 steffen Note Added: 0003847 2017-09-06 13:41 stephane Note Added: 0003848 2017-09-07 17:31 kre Note Deleted: 0003842 2017-09-07 17:58 kre Note Added: 0003849 2017-09-07 18:29 chet_ramey Note Added: 0003850 2017-09-07 21:17 kre Note Added: 0003851 2017-09-07 21:18 kre Note Edited: 0003851 2017-09-09 19:10 chet_ramey Note Added: 0003852 2018-04-25 17:57 McDutchie Note Added: 0003997 2019-01-24 17:11 nick Note Added: 0004220 2019-01-24 17:11 nick Interp Status => --- 2019-01-24 17:11 nick Final Accepted Text => See http://austingroupbugs.net/view.php?id=1161#c4220 2019-01-24 17:11 nick Status New => Resolved 2019-01-24 17:11 nick Resolution Open => Accepted As Marked 2019-01-24 17:12 nick Tag Attached: tc3-2008 2019-01-24 23:33 kre Note Added: 0004223 2019-01-25 00:05 kre Note Added: 0004224 2019-01-25 00:53 steffen Note Added: 0004225 2019-01-25 02:46 eblake Relationship added related to 0001226 2019-01-25 02:58 kre Note Added: 0004229 ======================================================================