Debian Bug report logs - #435648
manpages-dev: scanf description is ambiguous concerning %% and leading whitespace skipping

version graph

Package: manpages-dev; Maintainer for manpages-dev is Martin Schulze <joey@debian.org>; Source for manpages-dev is src:manpages.

Reported by: Vincent Lefevre <vincent@vinc17.org>

Date: Thu, 2 Aug 2007 11:00:04 UTC

Severity: normal

Tags: fixed-upstream

Found in version manpages/2.62-1

Fixed in version manpages/3.04-1

Done: Joey Schulze <joey@infodrom.org>

Bug is archived. No further changes may be made.

Toggle useless messages

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


Report forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#435648; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to Vincent Lefevre <vincent@vinc17.org>:
New Bug report received and forwarded. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Vincent Lefevre <vincent@vinc17.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: manpages-dev: scanf description is ambiguous concerning %% and leading whitespace skipping
Date: Thu, 2 Aug 2007 12:57:40 +0200
Package: manpages-dev
Version: 2.62-1
Severity: normal

The scanf man page says:

  ·  An  optional  decimal  integer which specifies the maximum field
     width.  Reading of characters stops either when this maximum  is
     reached  or  when  a  non-matching character is found, whichever
     happens first.   Most  conversions  discard  initial  whitespace
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     characters (the exceptions are noted below), and these discarded
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     characters don't count towards the maximum field width.   String
     input conversions store a null terminator ('\0') to mark the end
     of the input; the maximum field width does not include this ter-
     minator.

and

  The following conversion specifiers are available:

  %  Matches a literal '%'.  That is, %% in the format string matches
     a  single  input  '%'  character.   No  conversion  is done, and
                                         ^^^^^^^^^^^^^^^^^^^^^^^
     assignment does not occur.

So, one may think that since %% doesn't do a conversion, initial
whitespace is not discarded. But this is incorrect: initial whitespace
is discarded (as required by the ISO C standard). The C standard has
better wording ("conversion specification" instead of "conversion"):

  [...] A conversion specification is executed in the following steps:
                     ^^^^^^^^^^^^^

  Input white-space characters (as specified by the isspace function)
  are skipped, unless the specification includes a [, c, or n specifier.

The scanf man page should probably say: "... Most conversion
specifications discard initial whitespace characters ..."

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.18-4-686-bigmem (SMP w/2 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.ISO8859-1 (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages manpages-dev depends on:
ii  manpages                      2.62-1     Manual pages about using a GNU/Lin

manpages-dev recommends no packages.

-- no debconf information



Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#435648; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to Michael Kerrisk <mtk.manpages@googlemail.com>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #10 received at 435648@bugs.debian.org (full text, mbox):

From: Michael Kerrisk <mtk.manpages@googlemail.com>
To: Vincent Lefevre <vincent@vinc17.org>, 435648@bugs.debian.org
Cc: debc <control@bugs.debian.org>
Subject: Re: Bug#435648: manpages-dev: scanf description is ambiguous concerning %% and leading whitespace skipping
Date: Tue, 08 Jul 2008 17:47:01 +0200
tags 435648 fixed-upstream
thanks

fixed in upstream 3.04.

Hello Vincent,

Vincent Lefevre wrote:
> Package: manpages-dev
> Version: 2.62-1
> Severity: normal
> 
> The scanf man page says:
> 
>   ·  An  optional  decimal  integer which specifies the maximum field
>      width.  Reading of characters stops either when this maximum  is
>      reached  or  when  a  non-matching character is found, whichever
>      happens first.   Most  conversions  discard  initial  whitespace
>                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>      characters (the exceptions are noted below), and these discarded
>      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>      characters don't count towards the maximum field width.   String
>      input conversions store a null terminator ('\0') to mark the end
>      of the input; the maximum field width does not include this ter-
>      minator.
> 
> and
> 
>   The following conversion specifiers are available:
> 
>   %  Matches a literal '%'.  That is, %% in the format string matches
>      a  single  input  '%'  character.   No  conversion  is done, and
>                                          ^^^^^^^^^^^^^^^^^^^^^^^
>      assignment does not occur.
> 
> So, one may think that since %% doesn't do a conversion, initial
> whitespace is not discarded. But this is incorrect: initial whitespace
> is discarded (as required by the ISO C standard). The C standard has
> better wording ("conversion specification" instead of "conversion"):

Interestingly, the wording of the man page is quite close to the
POSIX.1 spec:
    %      Matches a single '%' character; no conversion or assignment
           occurs. The complete conversion specification shall be %% .

>   [...] A conversion specification is executed in the following steps:
>                      ^^^^^^^^^^^^^
> 
>   Input white-space characters (as specified by the isspace function)
>   are skipped, unless the specification includes a [, c, or n specifier.
> 
> The scanf man page should probably say: "... Most conversion
> specifications discard initial whitespace characters ..."

I prefer to be more explicit.  For the description of %% I changed
the text to:

    No conversion is done (but initial white space characters are
    discarded), and assignment does not occur.

okay?

Cheers,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html
Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html






Tags added: fixed-upstream Request was from Michael Kerrisk <mtk.manpages@googlemail.com> to control@bugs.debian.org. (Tue, 08 Jul 2008 15:54:14 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#435648; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to Vincent Lefevre <vincent@vinc17.org>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #17 received at 435648@bugs.debian.org (full text, mbox):

From: Vincent Lefevre <vincent@vinc17.org>
To: Michael Kerrisk <mtk.manpages@googlemail.com>
Cc: 435648@bugs.debian.org
Subject: Re: Bug#435648: manpages-dev: scanf description is ambiguous concerning %% and leading whitespace skipping
Date: Tue, 8 Jul 2008 18:58:54 +0200
On 2008-07-08 17:47:01 +0200, Michael Kerrisk wrote:
> Interestingly, the wording of the man page is quite close to the
> POSIX.1 spec:
>     %      Matches a single '%' character; no conversion or assignment
>            occurs. The complete conversion specification shall be %% .

IIRC, there have been discussions in the austin group mailing-list
about that.

> I prefer to be more explicit.  For the description of %% I changed
> the text to:
>
>     No conversion is done (but initial white space characters are
>     discarded), and assignment does not occur.
>
> okay?

Yes, this is fine.

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)




Reply sent to Joey Schulze <joey@infodrom.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Vincent Lefevre <vincent@vinc17.org>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #22 received at 435648-close@bugs.debian.org (full text, mbox):

From: Joey Schulze <joey@infodrom.org>
To: 435648-close@bugs.debian.org
Subject: Bug#435648: fixed in manpages 3.04-1
Date: Wed, 23 Jul 2008 09:17:29 +0000
Source: manpages
Source-Version: 3.04-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:

manpages-dev_3.04-1_all.deb
  to pool/main/m/manpages/manpages-dev_3.04-1_all.deb
manpages_3.04-1.diff.gz
  to pool/main/m/manpages/manpages_3.04-1.diff.gz
manpages_3.04-1.dsc
  to pool/main/m/manpages/manpages_3.04-1.dsc
manpages_3.04-1_all.deb
  to pool/main/m/manpages/manpages_3.04-1_all.deb
manpages_3.04.orig.tar.gz
  to pool/main/m/manpages/manpages_3.04.orig.tar.gz



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 435648@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Joey Schulze <joey@infodrom.org> (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 ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Wed, 23 Jul 2008 10:56:23 +0200
Source: manpages
Binary: manpages manpages-dev
Architecture: source all
Version: 3.04-1
Distribution: unstable
Urgency: low
Maintainer: Martin Schulze <joey@debian.org>
Changed-By: Joey Schulze <joey@infodrom.org>
Description: 
 manpages   - Manual pages about using a GNU/Linux system
 manpages-dev - Manual pages about using GNU/Linux for development
Closes: 435648 490868
Changes: 
 manpages (3.04-1) unstable; urgency=low
 .
   * New upstream version
     . Clarify "zero timeout" case in select(2) (closes: Bug#490868)
     . Clarify treatment of initial white space by %% conversion
       specification in scanf(3) (closes: Bug#435648)
Checksums-Sha1: 
 a79604c1e982c64ff09b4c8b2f320a0d5b75db87 964 manpages_3.04-1.dsc
 85e115c2e86b3f71985be0c52a06a1f4e3cacba8 1394674 manpages_3.04.orig.tar.gz
 2f07ed0b5ff8eec1e38310921143271fbd40de67 46625 manpages_3.04-1.diff.gz
 bdf9c6e9285cd7bac414a1d5acac6c70403423c8 608242 manpages_3.04-1_all.deb
 63be5cccb61b1d669034c96edc2f435b5468c8d3 1428976 manpages-dev_3.04-1_all.deb
Checksums-Sha256: 
 276dc265a555e8d9faf48e69187d44975c46279ad3f07ecb87bdb55f1cc81147 964 manpages_3.04-1.dsc
 54fa6c13b9953919302cc4d7982ba9d84db6cefa0d9a4b9d7618e364c66088cf 1394674 manpages_3.04.orig.tar.gz
 4f82f5a93fb027c1ebab645fe760f2ecec71ebadbb00124c179599506ebb4442 46625 manpages_3.04-1.diff.gz
 247c2c821eff3e519fcf446f47e2af3c41e10ba965aff1d901a504acca07a2bc 608242 manpages_3.04-1_all.deb
 9e9f721c8ad0ed9817b76ec4151da283aaac0b9ec86adee1f1dee6c0c4a0d531 1428976 manpages-dev_3.04-1_all.deb
Files: 
 bfeaba2ec9d63d25ea2bf5335e9fb8fc 964 doc important manpages_3.04-1.dsc
 3b257b63206672d23dd1fbf010ddbab8 1394674 doc important manpages_3.04.orig.tar.gz
 544192399c449909ef2fe4ce7b485d87 46625 doc important manpages_3.04-1.diff.gz
 ece0d65b229f7651821160ee7db173d7 608242 doc important manpages_3.04-1_all.deb
 9c1fbbd8f7dbe3673db13070f696b585 1428976 doc optional manpages-dev_3.04-1_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFIhvNZW5ql+IAeqTIRAvQjAKC5jiylugwu6Wzy62HNne1N/KYMRQCgkW6p
UahvlChjvm7JnV/mKP/ggNw=
=tOir
-----END PGP SIGNATURE-----





Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Thu, 21 Aug 2008 07:36:18 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Apr 20 09:38:10 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.