Austin Group Defect Tracker

Aardvark Mark IV

Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0001538 [1003.1(2016/18)/Issue7+TC2] Shell and Utilities Editorial Error 2021-12-05 06:48 2021-12-05 06:48
Reporter andras_farkas View Status public  
Assigned To
Priority normal Resolution Open  
Status New  
Name Andras Farkas
User Reference
Section what
Page Number
Line Number
Interp Status ---
Final Accepted Text
Summary 0001538: what -s is poorly described, uses the word "quit"
Description On: [^]
The -s option for what is described as so:
Quit after finding the first occurrence of the pattern in each file.
I find the usage of the word 'quit' here unfortunate, as it can be read as exiting or terminating.
Both "in each file" and the behavior of what on various BSDs leads me to believe "quit" isn't the best way to describe the behavior of -s as "what -s foo bar" on the BSDs doesn't quit after finding a pattern in foo. (it also checks bar after) If I understand right, this may be a correct behavior according to the standard.

In the man pages on NetBSD and OpenBSD, they describe -s as follows:
If the -s option is specified, only the first occurrence of an identification string in each file is printed.
On FreeBSD, the following phrasing is used:
Stop searching each file after the first match.
I also checked the phrasing in Solaris 10 and AIX 7.2 but don't have access to test actual behavior. (So I don't know if on SysV, "what -s foo bar" doesn't check bar if a pattern is found in foo)

I don't know if this is an Issue 7 or Issue 8 sort of thing to fix, so I have this marked as Issue 7.
Desired Action There may be a better wording than this, but this is what I recommend.

Quit after finding the first occurrence of the pattern in each file.
For each file, print only the first occurrence of the pattern.

I wonder if there's a way to make this more clear. -s doesn't make "pathname:" not get printed, so "print only" can still be misinterpreted. I'd like feedback and suggestions on this.

On that topic, the normative STDOUT section doesn't specify how printing works when multiple patterns are found, while the informative EXAMPLES section does. (Alternatively, this could be read as the STDOUT and EXAMPLES section defining different outputs)
Tags No tags attached.
Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2021-12-05 06:48 andras_farkas New Issue
2021-12-05 06:48 andras_farkas Name => Andras Farkas
2021-12-05 06:48 andras_farkas Section => what

Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker