From owner-freebsd-standards@FreeBSD.ORG Thu Apr 23 18:29:21 2015 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DA7BE546 for ; Thu, 23 Apr 2015 18:29:21 +0000 (UTC) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "troutmask", Issuer "troutmask" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BD2E011C7 for ; Thu, 23 Apr 2015 18:29:21 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.14.9/8.14.9) with ESMTP id t3NITFeW014457 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 23 Apr 2015 11:29:15 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.9/8.14.9/Submit) id t3NITEwa014456 for freebsd-standards@freebsd.org; Thu, 23 Apr 2015 11:29:14 -0700 (PDT) (envelope-from sgk) Date: Thu, 23 Apr 2015 11:29:14 -0700 From: Steve Kargl To: freebsd-standards@freebsd.org Subject: newlocale(3) appears to be broken? Message-ID: <20150423182733.GA14387@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Apr 2015 18:29:21 -0000 It appears that newlocale(3) is broken. First, the manpage indicates that one needs to use #include which leads to troutmask:sgk[204] cc -o z r.c r.c:1:10: fatal error: 'xlocale' file not found #include ^ 1 error generated. next the manpage says STANDARDS This function conforms to IEEE Std 1003.1-2008 (``POSIX.1''). However, http://pubs.opengroup.org/stage7tc1/functions/newlocale.html says newlocale is declared in locale.h. Now consider % cat r.c #include int main(void) { locale_t a; a = newlocale(0, "C", 0); if (a) return 0; else return 1; } troutmask:sgk[206] cc -o z -static r.c && ./z Segmentation fault (core dumped) troutmask:sgk[206] cc -o z -static r.c && ./z Segmentation fault (core dumped) troutmask:sgk[207] gdb782 z z.core [New process 100313] Core was generated by `z'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000000000415798 in newlocale () (gdb) bt #0 0x0000000000415798 in newlocale () #1 0x0000000000400434 in main () -- Steve