NetBSD Problem Report #53101

From www@NetBSD.org  Thu Mar 15 17:35:32 2018
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 48F987A1BC
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 15 Mar 2018 17:35:32 +0000 (UTC)
Message-Id: <20180315173531.242157A230@mollari.NetBSD.org>
Date: Thu, 15 Mar 2018 17:35:31 +0000 (UTC)
From: khw@cpan.org
Reply-To: khw@cpan.org
To: gnats-bugs@NetBSD.org
Subject: 6.1.5 nl_langinfo() swaps abbreviated vs full names in many locales
X-Send-Pr-Version: www-1.0

>Number:         53101
>Category:       lib
>Synopsis:       6.1.5 nl_langinfo() swaps abbreviated vs full names in many locales
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 15 17:40:01 +0000 2018
>Last-Modified:  Fri Mar 16 16:20:00 +0000 2018
>Originator:     Karl Williamson
>Release:        6.1.5
>Organization:
perl 5 porters
>Environment:
NetBSD cjg-netbsd6 6.1.5 NetBSD 6.1.5 (GENERIC) amd64
>Description:
Many locales have the full and abbreviated weekday and month names swapped.  so that asking for the abbreviated name yields the full name, and vice versa.  This happens in the C locale.  It does not happen in the POSIX locale.  I thought those two locales were supposed to be equivalent, which appears to be a second bug.

This is not an issue as far as we've seen in 7.1.1.  I did not see a fix in a search through the changes.  But, 6.1.5 is supposedly still supported.
>How-To-Repeat:
There's no way to attach a file, so I'm inlining this C program.  If called with a locale name, it uses that; otherwise it uses the C locale, and that fails

#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <langinfo.h>

int
main(int argc, char **argv)
{
    setlocale(LC_ALL, "C");

    if (argc > 1) {
        fprintf(stderr, "setlocale(LC_ALL, \"%s\")=%s\n", argv[1], setlocale(LC_ALL, argv[1]));
    }

    fprintf(stderr, "abbr\t full\n");
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABDAY_1), nl_langinfo(DAY_1));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABDAY_2), nl_langinfo(DAY_2));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABDAY_3), nl_langinfo(DAY_3));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABDAY_4), nl_langinfo(DAY_4));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABDAY_5), nl_langinfo(DAY_5));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABDAY_6), nl_langinfo(DAY_6));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABDAY_7), nl_langinfo(DAY_7));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABMON_1), nl_langinfo(MON_1));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABMON_2), nl_langinfo(MON_2));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABMON_3), nl_langinfo(MON_3));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABMON_4), nl_langinfo(MON_4));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABMON_5), nl_langinfo(MON_5));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABMON_6), nl_langinfo(MON_6));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABMON_7), nl_langinfo(MON_7));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABMON_8), nl_langinfo(MON_8));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABMON_9), nl_langinfo(MON_9));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABMON_10), nl_langinfo(MON_10));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABMON_11), nl_langinfo(MON_11));
    fprintf(stderr, "%s\t%s\n", nl_langinfo(ABMON_12), nl_langinfo(MON_12));
}

>Fix:

>Audit-Trail:
From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: lib/53101: 6.1.5 nl_langinfo() swaps abbreviated vs full names
 in many locales
Date: Fri, 16 Mar 2018 19:16:11 +0300

 This is fixed in 6-STABLE, the relevant changelog from doc/CHANGES-6.2

 lib/libc/locale/global_locale.c			patch

 	provide consistent and correct data for the C locale.
 	[joerg, ticket #934]


 The relevant commit is

 revision 1.12.2.1
 date: 2013-09-07 20:11:41 +0400;  author: bouyer;  state: Exp;  lines: +38 -38;  commitid: HURUJwL5bnZmww4x;
 Apply patch, requested by joerg in ticket #934:
 	lib/libc/locale/global_locale.c: patch
 provide consistent and correct data for the C locale.

 -uwe

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.