This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Analyzing a SEG FAULT that gdb doesn't help with
- From: Michael Enright <mike at kmcardiff dot com>
- To: cygwin at cygwin dot com
- Date: Sat, 1 Aug 2015 18:55:01 -0700
- Subject: Re: Analyzing a SEG FAULT that gdb doesn't help with
- Authentication-results: sourceware.org; auth=none
- References: <CAOC2fq_fahjLapKbgO8Xer8neEjv1Ohs4bM3JOWcka0ajjcbCg at mail dot gmail dot com> <55BA373A dot 4020909 at dronecode dot org dot uk> <55BB6F47 dot 1000906 at dronecode dot org dot uk> <CAOC2fq89HuStOLzEO9MxFZHBd54vmYfvp4juQyMKkNGkYG_D_g at mail dot gmail dot com> <CAOC2fq-DHmzwkv5CcnqzQ-VG0fTy_5X0pnc6pPTWVbRvhOzaGQ at mail dot gmail dot com> <loom dot 20150801T222419-312 at post dot gmane dot org>
On Sat, Aug 1, 2015 at 1:28 PM, Brian Inglis wrote:
>
> Seems like the problem may be developer confusion between strftime and
> printf conversion flag prefixes. The strftime space conversion flag
> character is _ so space filled seconds should use %_S, whereas the printf
> conversion flag character is space ' ', though I can't recall ever using
> that, as it is normally the default.
>
Well this code is not related to the strftime code in my other thread.
In this case it was just that a programmer didn't understand why
people do printf("%s",string) instead of printf(string). The program
takes lines out of log files, snarfs information out of them and makes
a report. Sometimes what belongs in the report is a copy of the entire
line from the log, so printf(line). But that would seem unwise in
general. In particular these log lines have prompts in them, and as
you know prompts often have '%' characters in them. It was only a
matter of time before this habit became a bad one.
So my email above is really the conclusion of the investigation, and
the fix is for me to switch the code to fputs in such cases.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple