Bug#756602: printf(3) manpage: please document that %n can't include flags, width or precision
On Thu, Jul 31, 2014 at 6:41 PM, Jakub Wilk jw...@debian.org wrote: * Michael Kerrisk mtk.manpa...@gmail.com, 2014-07-31, 12:42: I've applied the patch below. Thanks! +That argument shall be an +.I int\ *, +or variant, as specified by the +.B l +or +.B ll +length modifier. Hmm. Why only l or ll? According to the C99 standard, all the length modifiers that can be used with integer conversions (hh, h, l, ll, j, z, t) can be also used with %n. -- Jakub Wilk Good point. How about: [[ That argument shall be an .I int\ *, or variant whose size matches the (optionally) supplied integer length modifier. ]] ? Cheers, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/ -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#756602: printf(3) manpage: please document that %n can't include flags, width or precision
* Michael Kerrisk mtk.manpa...@gmail.com, 2014-08-01, 08:55: [[ That argument shall be an .I int\ *, or variant whose size matches the (optionally) supplied integer length modifier. ]] Looks good to me, thanks! Now I noticed that in the The length modifier subsection, the n conversion is mentioned only in the descriptions of hh, h, l, and ll. Could we make it more consistent? -- Jakub Wilk -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#756602: printf(3) manpage: please document that %n can't include flags, width or precision
On Fri, Aug 1, 2014 at 12:46 PM, Jakub Wilk jw...@debian.org wrote: * Michael Kerrisk mtk.manpa...@gmail.com, 2014-08-01, 08:55: [[ That argument shall be an .I int\ *, or variant whose size matches the (optionally) supplied integer length modifier. ]] Looks good to me, thanks! Now I noticed that in the The length modifier subsection, the n conversion is mentioned only in the descriptions of hh, h, l, and ll. Could we make it more consistent? I applied the below. Thanks, Michael diff --git a/man3/printf.3 b/man3/printf.3 index 47fdf2c..47fa149 100644 --- a/man3/printf.3 +++ b/man3/printf.3 @@ -527,6 +527,10 @@ A following integer conversion corresponds to an .I intmax_t or .I uintmax_t +argument, or a following +.B n +conversion corresponds to a pointer to an +.I intmax_t argument. .TP .B z @@ -534,6 +538,10 @@ A following integer conversion corresponds to a .I size_t or .I ssize_t +argument, or a following +.B n +conversion corresponds to a pointer to a +.I size_t argument. .\ (Linux libc5 has .\ .B Z @@ -543,6 +551,10 @@ argument. .B t A following integer conversion corresponds to a .I ptrdiff_t +argument, or a following +.B n +conversion corresponds to a pointer to a +.I ptrdiff_t argument. .PP SUSv2 knows about only the length modifiers -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#756602: printf(3) manpage: please document that %n can't include flags, width or precision
Package: manpages-dev Version: 3.65-1 Severity: minor The only place where flags for the n conversion are mentioned in description of the 0 flag: Except for n conversions, ... This is a bit odd, because the other flags don't make sense for %n either. In fact, the C99 standard says that if the n conversion specification includes any flags, a field width, or a precision, the behavior is undefined. Please document this fact in the manual page. -- Jakub Wilk -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#756602: printf(3) manpage: please document that %n can't include flags, width or precision
tags 756602 fixed-upstream thanks Hello Jakub, I've applied the patch below. Cheers, Michael --- a/man3/printf.3 +++ b/man3/printf.3 @@ -332,9 +332,7 @@ For other conversions, the behavior is undefined. .B \- The converted value is to be left adjusted on the field boundary. (The default is right justification.) -Except for -.B n -conversions, the converted value is padded on the right with blanks, rather +The converted value is padded on the right with blanks, rather than on the left with blanks or zeros. A .B \- @@ -788,10 +786,17 @@ or .TP .B n The number of characters written so far is stored into the integer -indicated by the -.I int\ * -(or variant) pointer argument. +pointed to by the corresponding argument. +That argument shall be an +.I int\ *, +or variant, as specified by the +.B l +or +.B ll +length modifier. No argument is converted. +The behavior is undefined if the conversion specification includes +any flags, a field width, or a precision. .TP .B m (Glibc extension.) -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#756602: printf(3) manpage: please document that %n can't include flags, width or precision
* Michael Kerrisk mtk.manpa...@gmail.com, 2014-07-31, 12:42: I've applied the patch below. Thanks! +That argument shall be an +.I int\ *, +or variant, as specified by the +.B l +or +.B ll +length modifier. Hmm. Why only l or ll? According to the C99 standard, all the length modifiers that can be used with integer conversions (hh, h, l, ll, j, z, t) can be also used with %n. -- Jakub Wilk -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org