This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
SV: [PATCH] Remove __wur attribute for printf/scanf functions
- From: Daniel Marjamäki <Daniel dot Marjamaki at evidente dot se>
- To: Mike Frysinger <vapier at gentoo dot org>
- Cc: "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Thu, 13 Aug 2015 08:20:34 +0000
- Subject: SV: [PATCH] Remove __wur attribute for printf/scanf functions
- Authentication-results: sourceware.org; auth=none
- References: <CA180F4D0C023044AA10FB1BDCAC4D1F0175EE0A at EX01 dot evidente dot local>,<20150812095904 dot GC23037 at vapier>
Hello!
> you're confusing asprintf as a benign printf
ok I guess so.
> as for the scanf family, see BZ #14254 and the thread from last time where we rejected this proposal:
thanks. however I am still not convinced. If I trust the input or think that 'garbage in => garbage out' is fine then ignoring the return value from scanf is ok.
I suggest a conservative approach that avoids FP; only use __wur if it's pointless or leads to UB to ignore the return value. calling strlen without using the return value would be pointless. calling fopen without taking the return value would probably lead to a resource leak.
If you still think that __wur should be used.. then let's keep it. I can live with the FP.
Best regards,
Daniel Marjamäki
..................................................................................................................
Daniel Marjamäki Senior Engineer
Evidente ES East AB Warfvinges väg 34 SE-112 51 Stockholm Sweden
Mobile: +46 (0)709 12 42 62
E-mail: Daniel.Marjamaki@evidente.se
www.evidente.se
________________________________________
Från: Mike Frysinger [vapier@gentoo.org]
Skickat: den 12 augusti 2015 11:59
Till: Daniel Marjamäki
Kopia: libc-alpha@sourceware.org
Ämne: Re: [PATCH] Remove __wur attribute for printf/scanf functions
On 12 Aug 2015 09:38, Daniel Marjamäki wrote:
> Imho the __wur attribute should not be used on printf/scanf functions.
>
> It is not insane to ignore the return value from these. these functions will perform the wanted I/O even though the return value is not used.
you're confusing asprintf as a benign printf. it is insane to not be checking
the return value of that function. it does memory allocation among other
things.
as for the scanf family, see BZ #14254 and the thread from last time where we
rejected this proposal:
https://sourceware.org/bugzilla/show_bug.cgi?id=14254
https://sourceware.org/ml/libc-alpha/2013-10/msg00290.html
-mike