From owner-freebsd-hackers Wed Dec 12 14:31:59 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from elmer.glueless.net (elmer.glueless.net [208.19.80.42]) by hub.freebsd.org (Postfix) with SMTP id 07D8637B421 for ; Wed, 12 Dec 2001 14:31:47 -0800 (PST) Received: (qmail 7315 invoked by uid 1000); 12 Dec 2001 22:29:35 -0000 Date: Wed, 12 Dec 2001 15:29:35 -0700 From: Dan Peterson To: Jos Backus Cc: freebsd-hackers@freebsd.org Subject: Re: sscanf(..., "%lld", ...) broken? Message-ID: <20011212152935.A7286@danp.net> References: <20011210201611.GB595@lizzy.bugworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20011210201611.GB595@lizzy.bugworks.com>; from josb@cncdsl.com on Mon, Dec 10, 2001 at 12:15:49PM -0801 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Jos Backus wrote: > Is this PR-worthy? I am seeing this in both -stable and -current. The lftp > author claims it's our bug, not his. > > > It seems to me that sscanf on FreeBSD does not correctly handle long > > long type (%lld). There is another similar report, the reporter says > > that initializing the variable to 0 before sscanf helps. This indicates > > a bug in the libc library. You can report a bug to FreeBSD team. I was the other reporter, and initializing the size_ll variable to 0 does fix it for me (be sure to do it in both the FTP listing code and the FTP mirroring code, though). Alexander provided this code to verify that it's a libc problem (it exits 1 for me under -STABLE): int main() { unsigned long long x=0,x1; long long y=0,y1; char buf[128]; x=~x; sscanf("0","%llu",&x); if(x!=0) return 1; y=~y; sscanf("0","%lld",&y); if(y!=0) return 1; x=~x; sprintf(buf,"%lld %llu",y,x); sscanf (buf,"%lld %llu",&y1,&x1); if(x!=x1 || y!=y1) return 1; return 0; } EPLF listing works fine in lftp-2.4.4 and before without patching which baffles me (the lftp code still uses sscanf). -- Dan Peterson http://danp.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message