Debian Bug report logs - #756602
printf(3) manpage: please document that %n can't include flags, width or precision

version graph

Package: manpages-dev; Maintainer for manpages-dev is Dr. Tobias Quathamer <[email protected]>; Source for manpages-dev is src:manpages (PTS, buildd, popcon).

Reported by: Jakub Wilk <[email protected]>

Date: Thu, 31 Jul 2014 09:30:02 UTC

Severity: minor

Tags: fixed-upstream

Found in version manpages/3.65-1

Fixed in version manpages/3.71-1

Done: Simon Paillard <[email protected]>

Bug is archived. No further changes may be made.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to [email protected], [email protected], Martin Schulze <[email protected]>:
Bug#756602; Package manpages-dev. (Thu, 31 Jul 2014 09:30:06 GMT) (full text, mbox, link).


Message #3 received at [email protected] (full text, mbox, reply):

From: Jakub Wilk <[email protected]>
To: Debian Bug Tracking System <[email protected]>
Subject: printf(3) manpage: please document that %n can't include flags, width or precision
Date: Thu, 31 Jul 2014 11:27:26 +0200
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



Information forwarded to [email protected], Martin Schulze <[email protected]>:
Bug#756602; Package manpages-dev. (Thu, 31 Jul 2014 10:45:13 GMT) (full text, mbox, link).


Acknowledgement sent to [email protected]:
Extra info received and forwarded to list. Copy sent to Martin Schulze <[email protected]>. (Thu, 31 Jul 2014 10:45:13 GMT) (full text, mbox, link).


Message #8 received at [email protected] (full text, mbox, reply):

From: "Michael Kerrisk (man-pages)" <[email protected]>
To: Jakub Wilk <[email protected]>, [email protected]
Cc: [email protected]
Subject: Re: Bug#756602: printf(3) manpage: please document that %n can't include flags, width or precision
Date: Thu, 31 Jul 2014 12:42:25 +0200
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.)



Added tag(s) fixed-upstream. Request was from "Michael Kerrisk (man-pages)" <[email protected]> to [email protected]. (Thu, 31 Jul 2014 10:45:17 GMT) (full text, mbox, link).


Information forwarded to [email protected], Martin Schulze <[email protected]>:
Bug#756602; Package manpages-dev. (Thu, 31 Jul 2014 16:45:04 GMT) (full text, mbox, link).


Message #13 received at [email protected] (full text, mbox, reply):

From: Jakub Wilk <[email protected]>
To: [email protected]
Cc: Michael Kerrisk <[email protected]>
Subject: Re: Bug#756602: printf(3) manpage: please document that %n can't include flags, width or precision
Date: Thu, 31 Jul 2014 18:41:24 +0200
* Michael Kerrisk <[email protected]>, 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



Information forwarded to [email protected], Martin Schulze <[email protected]>:
Bug#756602; Package manpages-dev. (Fri, 01 Aug 2014 06:57:04 GMT) (full text, mbox, link).


Acknowledgement sent to [email protected]:
Extra info received and forwarded to list. Copy sent to Martin Schulze <[email protected]>. (Fri, 01 Aug 2014 06:57:04 GMT) (full text, mbox, link).


Message #18 received at [email protected] (full text, mbox, reply):

From: "Michael Kerrisk (man-pages)" <[email protected]>
To: Jakub Wilk <[email protected]>
Cc: [email protected]
Subject: Re: Bug#756602: printf(3) manpage: please document that %n can't include flags, width or precision
Date: Fri, 1 Aug 2014 08:55:19 +0200
On Thu, Jul 31, 2014 at 6:41 PM, Jakub Wilk <[email protected]> wrote:
> * Michael Kerrisk <[email protected]>, 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/



Information forwarded to [email protected], Martin Schulze <[email protected]>:
Bug#756602; Package manpages-dev. (Fri, 01 Aug 2014 10:51:09 GMT) (full text, mbox, link).


Message #21 received at [email protected] (full text, mbox, reply):

From: Jakub Wilk <[email protected]>
To: [email protected]
Cc: Michael Kerrisk <[email protected]>
Subject: Re: Bug#756602: printf(3) manpage: please document that %n can't include flags, width or precision
Date: Fri, 1 Aug 2014 12:46:08 +0200
* Michael Kerrisk <[email protected]>, 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



Information forwarded to [email protected], Martin Schulze <[email protected]>:
Bug#756602; Package manpages-dev. (Fri, 01 Aug 2014 13:12:05 GMT) (full text, mbox, link).


Acknowledgement sent to [email protected]:
Extra info received and forwarded to list. Copy sent to Martin Schulze <[email protected]>. (Fri, 01 Aug 2014 13:12:05 GMT) (full text, mbox, link).


Message #26 received at [email protected] (full text, mbox, reply):

From: "Michael Kerrisk (man-pages)" <[email protected]>
To: Jakub Wilk <[email protected]>
Cc: [email protected]
Subject: Re: Bug#756602: printf(3) manpage: please document that %n can't include flags, width or precision
Date: Fri, 1 Aug 2014 15:08:06 +0200
On Fri, Aug 1, 2014 at 12:46 PM, Jakub Wilk <[email protected]> wrote:
> * Michael Kerrisk <[email protected]>, 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



Added tag(s) pending. Request was from Simon Paillard <[email protected]> to [email protected]. (Tue, 19 Aug 2014 20:33:06 GMT) (full text, mbox, link).


Reply sent to Simon Paillard <[email protected]>:
You have taken responsibility. (Thu, 21 Aug 2014 21:36:36 GMT) (full text, mbox, link).


Notification sent to Jakub Wilk <[email protected]>:
Bug acknowledged by developer. (Thu, 21 Aug 2014 21:36:36 GMT) (full text, mbox, link).


Message #33 received at [email protected] (full text, mbox, reply):

From: Simon Paillard <[email protected]>
To: [email protected]
Subject: Bug#756602: fixed in manpages 3.71-1
Date: Thu, 21 Aug 2014 21:34:28 +0000
Source: manpages
Source-Version: 3.71-1

We believe that the bug you reported is fixed in the latest version of
manpages, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Simon Paillard <[email protected]> (supplier of updated manpages package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Thu, 21 Aug 2014 23:05:57 +0200
Source: manpages
Binary: manpages manpages-dev
Architecture: source all
Version: 3.71-1
Distribution: unstable
Urgency: medium
Maintainer: Martin Schulze <[email protected]>
Changed-By: Simon Paillard <[email protected]>
Description:
 manpages   - Manual pages about using a GNU/Linux system
 manpages-dev - Manual pages about using GNU/Linux for development
Closes: 708394 728240 729436 745775 746569 748887 754514 756602
Changes:
 manpages (3.71-1) unstable; urgency=medium
 .
   * Imported Upstream version 3.71 (Closes: #754514)
     . getrusage.2: _GNU_SOURCE must be defined to obtain RUSAGE_THREAD
       definition (Closes: #746569)
     . strcasecmp.3: Explain why defined in both <string.h>
       and <strings.h> (Closes: #729436)
     . stat.2: Describe feature test macro requirements for file type test
       macro (Closes: #728240)
     . connect.2: ERRORS: Add EADDRNOTAVAIL for ephemeral port range exhaustion
       (Closes: #745775)
     . stdio.3: typo fix (Closes: #748887)
     . connect.2: ERRORS: add EPROTOTYPE (Closes: #708394)
     . printf.3: details of the %n conversion specifier (Closes: #756602)
     . new manpages:
       fanotify.7 fanotify_init.2 fanotify_mark.2 group_member.3
       iconv.1 iconvconfig.8 isfdtype.3 localedef.1 procfs.5 renameat2.2
       repertoiremap.5 sched.7 sched_getattr.2 sched_setattr.2 sched_setattr.2
       sprof.1
   * d/control: Take over iconv.1 localedef.1 iconvconfig.8 from libc-bin,
     and sprof.1 from libc-dev-bin
Checksums-Sha1:
 042dc3096bc7356abfa14143ca28bfe0723d91b2 1930 manpages_3.71-1.dsc
 e603af41f46fe730cb57dcd3d234512c088ddbdf 1272416 manpages_3.71.orig.tar.xz
 d8152cc6b16e08ca2e7292d547191aeb647b24d4 62944 manpages_3.71-1.debian.tar.xz
 da63378fc32465dc2e084ba925e1ce65d9ecfbb3 962042 manpages_3.71-1_all.deb
 b58cb72db0d782f0b37001db102ee1701fad2db3 1860718 manpages-dev_3.71-1_all.deb
Checksums-Sha256:
 94687097d1ae7e23c873879c19e1f339d10ed8ff876900c8c12d8fcac0072948 1930 manpages_3.71-1.dsc
 981038ecffcf6db490c0bc4359f489c318654068a6ba5aa086962ac41b0d2894 1272416 manpages_3.71.orig.tar.xz
 bbd4037f8de8599875338b971d07fb398487f198ff696278eae6013716873883 62944 manpages_3.71-1.debian.tar.xz
 5b84cc01c51a481fe209f34963f64b9375c47e192415f9d40f9331ac5ba3c416 962042 manpages_3.71-1_all.deb
 5925ac2346cdf03cbf82b9ae0c59e46d3cab76e3f0d8d015176b128625d92ec6 1860718 manpages-dev_3.71-1_all.deb
Files:
 688fb0add5141ee029e32f359f55896d 962042 doc important manpages_3.71-1_all.deb
 ae286d2f258ce8dce17d5d263a95e33a 1860718 doc optional manpages-dev_3.71-1_all.deb
 b6b8555ae3c0a906c9d7c66acb08eb37 1930 doc important manpages_3.71-1.dsc
 9a2a288f1e481045c991e0cb476127d8 1272416 doc important manpages_3.71.orig.tar.xz
 9b99fa2fd1c714b9ebdbab182868899a 62944 doc important manpages_3.71-1.debian.tar.xz

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJT9mS1AAoJEN/3OMLRbPuiVRUP/AsgrF1wnreXjO7dY8mjC4Ow
zki8TxJHW4yCEzEw/r60oTlxUYcK0okE9Kyee+t5mDDkE16IhYpsTlZEQxQ8nBmg
zhDrG1pJGwR3fIUm416MTA0zxaoVAYWZhbwgAGKy7DDEqjVietkQUW/xIemr30QE
s4EHeQclVelyOHkurMtvLPBPBZhJHQzKqg8XaZi6l1BMDXJCE5KNml3LTRPCAVEh
fsn9q30BeEQacBlv3JRz2W0Al3iMkSXCndFuIDgu4leHev+F/qIq1gxja13xNhcS
B4P+caeI/epvyqctXVDa3sVsa/57VyyQIzEXuYj6I2HGWulIYyTlj2c5RUgNefZg
gdb2Xu8fhYK4CUAcoHmqUgU0AFf2yw5+0VQthsfnUlSGJlrlacQbIiJLSwiS33vC
OxmGrOw0h86uYS6+BsgYa2KMlMRk+F/PcXKwkSyGi60F+wnOiVOFPmLuplMqL125
7VSc9F94rcXwQZBzCm0hX7dz+2GeZZrlttk+O8BO2MB4B/wUPF306zTpgyX3fgYr
DFLyd2aETX6B7mVxf/23bujewalzaJ1hpnc4o1cnupsiueP3qCL90uMjLwEsNN/B
819tG1LyOuzF9sRRqkIBJ6f0mNm/567Wxr0B5kpysP1bqOf05A09GlQ62bdZno4b
q1R3lz8k/UTmo3YRkSp1
=Z0ol
-----END PGP SIGNATURE-----




Bug archived. Request was from Debbugs Internal Request <[email protected]> to [email protected]. (Wed, 24 Sep 2014 07:25:46 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Sat Sep 21 23:32:44 2024; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.