From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1007 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: printf POSIX compliance Date: Fri, 8 Jun 2012 10:44:23 -0400 Message-ID: <20120608144423.GN163@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1339166945 10843 80.91.229.3 (8 Jun 2012 14:49:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 8 Jun 2012 14:49:05 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1008-gllmg-musl=m.gmane.org@lists.openwall.com Fri Jun 08 16:49:04 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Sd0Un-0002Cz-IV for gllmg-musl@plane.gmane.org; Fri, 08 Jun 2012 16:49:01 +0200 Original-Received: (qmail 25853 invoked by uid 550); 8 Jun 2012 14:48:59 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 25845 invoked from network); 8 Jun 2012 14:48:59 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:1007 Archived-At: On Fri, Jun 08, 2012 at 11:34:04AM +0100, Reuben Thomas wrote: > I notice that the musl FAQ says "the fundamentally broken freadahead > function in gnulib cannot be fixed by adding features to the C > library". I found this question because a user complained about my use > of gnulib in a package I maintain. > > I contacted the gnulib maintainers, one of whom replied: > > "IIRC, gnulib's freadahead use is caused by musl's printf not being > posix compliant, causing gnulib to pull in its printf replacement, > which doesn't work on musl." The first failing test I found was invalid. It's a test for whether printf supports printing non-finite long double values. gnulib is constructing an illegal long double representation (which they call "pseudo-denormal") that will never occur as a value and passing it to printf: | { /* Pseudo-Denormal. */ | static union { unsigned int word[4]; long double value; } x = | { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; | if (sprintf (buf, "%Lf", x.value) < 0 | || !strisnan (buf, 0, strlen (buf))) | result |= 64; This test should simply be removed; there is no reason printf should handle invalid bit patterns that cannot occur as values. The second failing test actually caught a slight bug in %ls with precision modifiers. I've fixed it in musl git. Still working on finding whether this long double issue is what's causign the gnulib junk to get pulled in... Rich