Bug 2536 - standardized formatting of warnings and errors
Summary: standardized formatting of warnings and errors
Status: RESOLVED WONTFIX
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 enhancement
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-11 23:31 UTC by Dave Yost
Modified: 2019-04-10 09:21 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Yost 2006-04-11 23:31:51 UTC
It would be nice if there were a reliable way to grep for errors in the output of make.  But this is 
unachievable today because every tool that make runs has its own style of reporting errors and 
warnings.  There should be a standard way.

I propose a new library function:
  #define TROUBLE_ERROR "error: "
  #define TROUBLE_WARNING "warning: "
  extern char* trouble(char* trouble, char* message);
If a TROUBLE_STANDARD environment variable is present, the returned string is prepended with the 
first argument. Otherwise, the returned string is the same as the given message.

If the TROUBLE_PREFIXES environment variable is present, it can replace default prefixes as desired.  For 
example:
  export TROUBLE_PREFIXES='~error:~***ERROR: ~warning: ~*WARNING: ~'
where ~ can be any character a la sed replacement.

All gnu commands should be updated to use the new mechanism. In case legacy software is going to 
look at the output, and the software requires the exact previous error syntax, full backward 
compatibility is retained by not defining the TROUBLE_STANDARD environment variable.
Comment 1 Ulrich Drepper 2006-04-12 16:17:09 UTC
There is fmtmsg and nobody uses it.