This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [BZ #10631] Clarify malloc error diagnostics to avoidconfusion


On 9/18/2012 3:43 AM, Dmitry V. Levin wrote:
>>>        __libc_message (action & 2,
>>> -                     "*** glibc detected *** %s: %s: 0x%s ***\n",
>>> +                     "*** glibc has detected an error in %s: %s: 0x%s ***\n",
>>>                       __libc_argv[0] ?: "<unknown>", str, cp);
>>>      }
>>>    else if (action & 2)
>>
>> The change is trivial but it may break scripts and diagnostic
>> utilities that may be using the earlier format.
> 
> The message is for people rather than for automated processing by scripts.
> Anyway, it is not part of libc ABI so the wording may change.  More than
> that, some distributions already have this change for several years, so
> any tool that rely on strict wording is already unportable.
 
All output from all tools is for people *and* automated processing and represents
a loose contract between the producer and consumer even though it is not a strict ABI.

Also the fact that a distribution has changed the wording doesn't make this change
correct; each of these changes needs to be reviewed individually.

In this particular case I'm OK with type of change. Why? The change does not alter
the STR content which describes the *real* error e.g. "corrupted double-linked list",
which is more important IMO than the prefix string. 

Old string example:
*** glibc detected *** ./a.out: free(): invalid next size (fast): 0x084ed538 ***

New string example:
*** glibc has detected an error in ./a.out: free(): invalid next size (fast): 0x084ed538 ***

It now says:
* Who detected the error? glibc detected the error.
* What had the error? The application had the error.

We should also quote the application name and error message e.g.

*** glibc has detected an error in [./a.out], the error is: [free(): invalid next size (fast)]: 0x084ed538 ***

* The application name is isolated from the error message by "", hopefully
  preventing clever application names from being used to trick users e.g.
  `glibc has detected an error in your hard drive, please delete the following files ...'
  would become:
  `glibc has detected an error in [your hard drive, please delete the following files ...]'
  Alternatively use double quotes, but that's not as visible as square brackets.

* The error message is identified to help developers identify exactly what
  is the error message was so we can go grep for it.

I'm perfectly happy with error messages > 80 characters.

Comments?

Cheers,
Carlos.
-- 
Carlos O'Donell
Mentor Graphics / CodeSourcery
carlos_odonell@mentor.com
carlos@codesourcery.com
+1 (613) 963 1026


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]