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

Bug#289264: marked as done (libc6: scanf() wrong results)



Your message dated Thu, 13 Jan 2005 11:11:04 +0900
with message-id <818y6yrscn.wl@omega.webmasters.gr.jp>
and subject line Bug#289264: libc6: scanf() wrong results **never mind**
has caused the attached Bug report 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 I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 8 Jan 2005 03:35:30 +0000
>From vojta@math.berkeley.edu Fri Jan 07 19:35:30 2005
Return-path: <vojta@math.berkeley.edu>
Received: from mail.math.berkeley.edu [169.229.58.57] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1Cn7Ny-0001pX-00; Fri, 07 Jan 2005 19:35:30 -0800
Received: from blue3.math.berkeley.edu (IDENT:248@blue3.Math.Berkeley.EDU [169.229.58.191])
	by mail.math.berkeley.edu (8.13.2/8.12.11) with ESMTP id j083ZTpD049006;
	Fri, 7 Jan 2005 19:35:29 -0800 (PST)
	(envelope-from vojta@math.berkeley.edu)
Received: (from vojta@localhost)
	by blue3.math.berkeley.edu (8.12.10+Sun/8.12.10/Submit) id j083ZSOl020761;
	Fri, 7 Jan 2005 19:35:28 -0800 (PST)
Message-Id: <[🔎] 200501080335.j083ZSOl020761@blue3.math.berkeley.edu>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: libc6: scanf() wrong results
From: Paul Vojta <vojta@Math.Berkeley.EDU>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============0504867712=="
X-Mailer: reportbug 3.5
Date: Fri, 07 Jan 2005 19:28:06 -0800
X-Debbugs-Cc: vojta@math.berkeley.edu
X-Scanned-By: MIMEDefang 2.49 on 169.229.58.57
Delivered-To: submit@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-11.0 required=4.0 tests=BAYES_00,HAS_PACKAGE,
	X_DEBBUGS_CC autolearn=ham version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level: 

This is a multi-part MIME message sent by reportbug.

--===============0504867712==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: libc6
Version: 2.3.2.ds1-20
Severity: normal

scanf() sometimes produces erroneous results (it reads part of the next
line when it shouldn't).  See the attached program (which runs correctly
on Solaris 9).


-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.4.27
Locale: LANG=C, LC_CTYPE=en_US.ISO-8859-1 (charmap=ISO-8859-1)

Versions of packages libc6 depends on:
ii  libdb1-compat                 2.1.3-7    The Berkeley database routines [gl

-- no debconf information

--===============0504867712==
Content-Type: text/x-c; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="scanftest.c"

#include <stdio.h>

/*
 * This program exhibits a bug with scanf() processing.
 *
 * Compile with:
 *	gcc -Wall -o scanftest scanftest.c
 *
 * Run with:
 *	./scanftest < data
 * or
 *	./scanftest < data | diff data -
 *
 * The output should coincide with the input, but it doesn't.
 */

int
main()
{
	int	n;
	char	name[3];
	int	hw[17];
	int	i;

	n = 0;
	for (;;) {
	    double	h[17];
	    double	junk;

	    i = scanf("%c%c%c "
	      "%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf "
	      "%lf %lf %lf %lf\n",
	      &name[0], &name[1], &name[2],
	      &h[0], &h[1], &h[2], &h[3], &h[4], &h[5], &h[6], &h[7], &h[8],
	      &h[9], &h[10], &h[11], &h[12], &h[13], &h[14], &h[15], &h[16],
	      &junk);

	    if (i == EOF) break;
	    if (i != 20) {
		fprintf(stderr, "At line %d, got %d values instead of 20.\n",
		  n + 1, i);
		return 1;
	    }

	    for (i = 0; i < 17; ++i)
		hw[i] = h[i];

	    printf("%c%c%c", name[0], name[1], name[2]);
	    for (i = 0; i < 16; ++i)
		printf(" %2d", hw[i]);
	    printf("%2d\n", hw[16]);

	    ++n;
	}

	return 0;
}

--===============0504867712==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="data"

Abc  0  1  2  3  4  5  6  7  8  9 10 11 12 13 23 34 0
Bcd  1  2  3  4  5  6  7  8  9 10 11 12 13 14 24 35 0
Cde  2  3  4  5  6  7  8  9 10 11 12 13 14 15 25 36 0
Def  3  4  5  6  7  8  9 10 11 12 13 14 15 16 26 37 0
Efg  4  5  6  7  8  9 10 11 12 13 14 15 16 17 27 38 0
Fgh  5  6  7  8  9 10 11 12 13 14 15 16 17 18 28 39 0
Ghi  6  7  8  9 10 11 12 13 14 15 16 17 18 19 29 40 0
Hij  7  8  9 10 11 12 13 14 15 16 17 18 19 20 30 41 0
Ijk  8  9 10 11 12 13 14 15 16 17 18 19 20 21 31 42 0
Jkl  9 10 11 12 13 14 15 16 17 18 19 20 21 22 32 43 0
Klm 10 11 12 13 14 15 16 17 18 19 20 21 22 23 33 44 0
Lmn 11 12 13 14 15 16 17 18 19 20 21 22 23 24 34 45 0
Mno 12 13 14 15 16 17 18 19 20 21 22 23 24 25 35 46 0
Nop 13 14 15 16 17 18 19 20 21 22 23 24 25 26 36 47 0
Opq 14 15 16 17 18 19 20 21 22 23 24 25 26 27 37 48 0
Pqr 15 16 17 18 19 20 21 22 23 24 25 26 27 28 38 49 0

--===============0504867712==--

---------------------------------------
Received: (at 289264-done) by bugs.debian.org; 13 Jan 2005 02:11:05 +0000
>From gotom@debian.or.jp Wed Jan 12 18:11:05 2005
Return-path: <gotom@debian.or.jp>
Received: from omega.webmasters.gr.jp (webmasters.gr.jp) [218.44.239.78] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1CouS1-0005y5-00; Wed, 12 Jan 2005 18:11:05 -0800
Received: from omega.webmasters.gr.jp (localhost [127.0.0.1])
	by webmasters.gr.jp (Postfix) with ESMTP
	id B4C06DEB4B; Thu, 13 Jan 2005 11:11:04 +0900 (JST)
Date: Thu, 13 Jan 2005 11:11:04 +0900
Message-ID: <818y6yrscn.wl@omega.webmasters.gr.jp>
From: GOTO Masanori <gotom@debian.or.jp>
To: Paul Vojta <vojta@Math.Berkeley.EDU>, 289264-done@bugs.debian.org
Subject: Re: Bug#289264: libc6: scanf() wrong results **never mind**
In-Reply-To: <[🔎] 200501110548.j0B5mBSK019712@blue3.math.berkeley.edu>
References: <[🔎] 200501110548.j0B5mBSK019712@blue3.math.berkeley.edu>
User-Agent: Wanderlust/2.9.9 (Unchained Melody) SEMI/1.14.3 (Ushinoya)
 FLIM/1.14.3 (=?ISO-8859-4?Q?Unebigory=F2mae?=) APEL/10.3 Emacs/21.2
 (i386-debian-linux-gnu) MULE/5.0 (SAKAKI)
MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya")
Content-Type: text/plain; charset=US-ASCII
Delivered-To: 289264-done@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-6.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER 
	autolearn=no version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level: 

At Mon, 10 Jan 2005 21:48:12 -0800 (PST),
Paul Vojta wrote:
> Upon further looking at things, I figured out that this isn't a bug
> after all.  (Or, more precisely, it's a bug in my understanding of white
> space.)
> 
> Feel free to close this bug.

Thanks for your catching up of this bug.  I close this bug.

Regards,
-- gotom



Reply to: