NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/53101: 6.1.5 nl_langinfo() swaps abbreviated vs full names in many locales

>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
>Originator:     Karl Williamson
>Release:        6.1.5
perl 5 porters
NetBSD cjg-netbsd6 6.1.5 NetBSD 6.1.5 (GENERIC) amd64
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.
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>

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));


Home | Main Index | Thread Index | Old Index