From owner-freebsd-bugs Mon Jul 17 15:50:14 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id C2B8237B831 for ; Mon, 17 Jul 2000 15:50:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id PAA72773; Mon, 17 Jul 2000 15:50:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from iss-p10.lbl.gov (iss-p10.lbl.gov [131.243.2.35]) by hub.freebsd.org (Postfix) with ESMTP id 24A6237B65B for ; Mon, 17 Jul 2000 15:45:43 -0700 (PDT) (envelope-from jin@iss-p10.lbl.gov) Received: (from jin@localhost) by iss-p10.lbl.gov (8.9.3/8.9.3) id PAA00517; Mon, 17 Jul 2000 15:45:42 -0700 (PDT) (envelope-from jin) Message-Id: <200007172245.PAA00517@iss-p10.lbl.gov> Date: Mon, 17 Jul 2000 15:45:42 -0700 (PDT) From: Jin Guojun (DSD staff) Reply-To: j_guojun@lbl.gov To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: misc/19994: sscanf() fails on 64-bit operations Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 19994 >Category: misc >Synopsis: sscanf() fails on 64-bit operations >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jul 17 15:50:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Jin Guojun (DSD staff) >Release: FreeBSD 4.0-20000627-STABLE i386 >Organization: >Environment: FreeBSD all releases >Description: sscanf(), and maybe scanf ..., fails on 64-bit operation. On Solaris, IRIX and Linux systems, the code below outputs: % hextodec -r 963870220966261 0x00036CA286215975 % hextodec 0x00036CA286215975 963870220966261 % hextodec 0x2804C6B886215975 2883648157250574709 Under FreeBSD % hextodec -r 963870220966261 0x2804C6B886215975 % hextodec 0x00036CA286215975 2883648157250574709 % hextodec 0x2804C6B886215975 # this seems correct 2883648157250574709 >How-To-Repeat: main(argc, argv) { int rev, i = 1; if (!strcmp(argv[i], "-r")) { rev = 1; i++; } else rev = 0; { int64_t h; rev ? sscanf(argv[i], "%lld", &h) : sscanf(argv[i], "%llx", &h); printf(rev ? "0x%016llX\n": "%lld\n", h); } } >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message