[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#668581: marked as done (gcc-4.6: scanf() wrong read on 08 09 integers)



Your message dated Fri, 13 Apr 2012 09:31:16 +0200
with message-id <4F87D644.1030809@free.fr>
and subject line Re: Bug#668581: gcc-4.6: scanf() wrong read on 08 09 integers
has caused the Debian Bug report #668581,
regarding gcc-4.6: scanf() wrong read on 08 09 integers
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
668581: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=668581
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: gcc-4.6
Version: 4.6.3-3
Severity: normal

Hi,

I was debugging a more complex problem and noticed that not all
input values were read. Further inspection showed that input
integers "08" and "09" (read from a file) were not correctly
recognised by fscanf() as two integers (8 and 9) but as four
integers (0 8 0 9). I've attached a minimal test C program
and a test file. After compile execute:
$ ./tscanf0809 < tscanf0809.txt

Thanks


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=ro_RO.utf8, LC_CTYPE=ro_RO.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages gcc-4.6 depends on:
ii  binutils      2.22-6
ii  cpp-4.6       4.6.3-3
ii  gcc-4.6-base  4.6.3-3
ii  libc6         2.13-27
ii  libgcc1       1:4.7.0-3
ii  libgmp10      2:5.0.4+dfsg-1
ii  libgomp1      4.7.0-3
ii  libmpc2       0.9-4
ii  libmpfr4      3.1.0-4
ii  libquadmath0  4.7.0-3
ii  zlib1g        1:1.2.6.dfsg-2

Versions of packages gcc-4.6 recommends:
ii  libc6-dev  2.13-27

Versions of packages gcc-4.6 suggests:
pn  binutils-gold        <none>
pn  gcc-4.6-doc          <none>
pn  gcc-4.6-locales      4.6.3-3
pn  gcc-4.6-multilib     <none>
pn  libgcc1-dbg          1:4.7.0-3
pn  libgomp1-dbg         <none>
pn  libmudflap0-4.6-dev  <none>
pn  libmudflap0-dbg      <none>
pn  libquadmath0-dbg     <none>

-- no debconf information
#include <stdio.h>

int main(void)
{
	int n;

	while (1 == scanf("%i", &n))
		printf("n = %i\n", n);
	return 0;
}
01
02
03
04
05
06
07
08
09
10

01 02 03 04 05 06 07 08 09 10

--- End Message ---
--- Begin Message ---
  Hi,

> scanf("%i", &n)

  With %i, the input base depend on the prefix (0x => hexa,
*0* => octal, ...)
  Use %d if you want to always read a decimal.

  Regards,
    Vincent



--- End Message ---

Reply to: