From owner-freebsd-current Fri Mar 2 4:52:40 2001 Delivered-To: freebsd-current@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id 6219337B719; Fri, 2 Mar 2001 04:52:24 -0800 (PST) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.0/8.11.0) id f22CqA206495; Fri, 2 Mar 2001 14:52:10 +0200 (EET) (envelope-from ru) Date: Fri, 2 Mar 2001 14:52:10 +0200 From: Ruslan Ermilov To: Andrey Chernov , current@FreeBSD.org Subject: **HEADS UP** essential setlocale(3) fix Message-ID: <20010302145210.A6392@sunbay.com> Mail-Followup-To: Andrey Chernov , current@FreeBSD.org References: <200103021245.f22CjrQ34193@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200103021245.f22CjrQ34193@freefall.freebsd.org>; from ru@FreeBSD.org on Fri, Mar 02, 2001 at 04:45:53AM -0800 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi! I have just committed the following fix to the setlocale(3) that changes the meaning of the LC_ALL environment variable so that it conforms to ISO and POSIX standards. On Fri, Mar 02, 2001 at 04:45:53AM -0800, Ruslan Ermilov wrote: > ru 2001/03/02 04:45:53 PST > > Modified files: > lib/libc/locale setlocale.c > Log: > Fix setlocale() to conform to the ISO C and POSIX standards. > The below text is quoted from the latest POSIX draft: > > : The values of locale categories shall be determined by a precedence > : order; the first condition met below determines the value: > : > : 1. If the LC_ALL environment variable is defined and is not null, > : the value of LC_ALL shall be used. > : 2. If the LC_* environment variable (LC_COLLATE, LC_CTYPE, LC_MESSAGES, > : LC_MONETARY, LC_NUMERIC, LC_TIME) is defined and is not null, the > : value of the environment variable shall be used to initialize the > : category that corresponds to the environment variable. > : 3. If the LANG environment variable is defined and is not null, the > : value of the LANG environment variable shall be used. > : 4. If the LANG environment variable is not set or is set to the empty > : string, the implementation-defined default locale shall be used. > > The conditions 1 and 2 were interchanged, i.e., LC_* were looked first, > then LC_ALL, then LANG (note that LC_ALL and LANG were essentially the > same, providing the default, with LC_ALL taking precedence over LANG). > Now, LC_ALL and LANG serve the different purposes. LC_ALL overrides > any LC_*, and LANG provides the default fallback. > > Testcase: > > /usr/bin/env LC_ALL=C LC_TIME=de_DE.ISO_8859-1 /bin/date > > Should return date in the "C" locale format. > > Inspired by: date(1) reference page in the Draft > > Revision Changes Path > 1.30 +4 -4 src/lib/libc/locale/setlocale.c -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message