public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: keld@keldix.com
To: Mike Frysinger <vapier@gentoo.org>
Cc: libc-alpha@sourceware.org, carlos@redhat.com
Subject: Re: [PATCH] localedef: check LC_IDENTIFICATION.category values
Date: Thu, 14 Apr 2016 09:26:00 -0000	[thread overview]
Message-ID: <20160414092626.GB19618@www5.open-std.org> (raw)
In-Reply-To: <20160414085919.GA19618@www5.open-std.org>

Actually the standards 14652/30112 were set up so you could declare
what version of the locale category was used for the data.
POSIX is different from 14652 and again different from 30112.
30112 is the one that most closely corresponds to glibc implementations.


I also think that POSIX allows for more categories than the ones that the
9945 standard defines, and in that way 14652 and 30112 are compatible 
with POSIX. I would advise that this still be allowed, but then declared
in the LC_IDENTIFICATION section. Maybe we should use a specifiv version value like
"non-standard" to indicate that.

I would advice to use the values for the locale versions
given in 30112. The values defined in 30112 are:
i18n:2004
i18n:2012
posix:1993

Best regards
Keld


On Thu, Apr 14, 2016 at 10:59:19AM +0200, keld@keldix.com wrote:
> Please also allow ISO 30112 categories.
> 
> best regards
> keld
> 
> On Wed, Apr 13, 2016 at 06:45:32PM -0400, Mike Frysinger wrote:
> > Currently localedef accepts any value for the category keyword.  This has
> > allowed bad values to propagate to the vast majority of locales (~90%).
> > Add some logic to only accept the 1993 POSIX and 2002 ISO-14652 standards.
> > 
> > 2016-04-13  Mike Frysinger  <vapier@gentoo.org>
> > 
> > 	* locale/programs/ld-identification.c (identification_finish): Check
> > 	that the values in identification->category are only posix:1993 or
> > 	i18n:2002.
> > ---
> >  locale/programs/ld-identification.c | 42 ++++++++++++++++++++++++++++++-------
> >  1 file changed, 35 insertions(+), 7 deletions(-)
> > 
> > diff --git a/locale/programs/ld-identification.c b/locale/programs/ld-identification.c
> > index 1e8fa84..eccb388 100644
> > --- a/locale/programs/ld-identification.c
> > +++ b/locale/programs/ld-identification.c
> > @@ -164,14 +164,42 @@ No definition for %s category found"), "LC_IDENTIFICATION"));
> >    TEST_ELEM (date);
> >  
> >    for (num = 0; num < __LC_LAST; ++num)
> > -    if (num != LC_ALL && identification->category[num] == NULL)
> > -      {
> > -	if (verbose && ! nothing)
> > -	  WITH_CUR_LOCALE (error (0, 0, _("\
> > +    {
> > +      /* We don't accept/parse this category, so skip it early.  */
> > +      if (num == LC_ALL)
> > +	continue;
> > +
> > +      if (identification->category[num] == NULL)
> > +	{
> > +	  if (verbose && ! nothing)
> > +	    WITH_CUR_LOCALE (error (0, 0, _("\
> >  %s: no identification for category `%s'"),
> > -				  "LC_IDENTIFICATION", category_name[num]));
> > -	identification->category[num] = "";
> > -      }
> > +				    "LC_IDENTIFICATION", category_name[num]));
> > +	  identification->category[num] = "";
> > +	}
> > +      else
> > +	{
> > +	  /* Only list the standards we care about.  */
> > +	  static const char * const standards[] =
> > +	    {
> > +	      "posix:1993",
> > +	      "i18n:2002",
> > +	    };
> > +	  size_t i;
> > +	  bool matched = false;
> > +
> > +	  for (i = 0; i < sizeof (standards) / sizeof (standards[0]); ++i)
> > +	    if (strcmp (identification->category[num], standards[i]) == 0)
> > +	      matched = true;
> > +
> > +	  if (matched != true)
> > +	    WITH_CUR_LOCALE (error (0, 0, _("\
> > +%s: unknown standard `%s' for category `%s'"),
> > +				    "LC_IDENTIFICATION",
> > +				    identification->category[num],
> > +				    category_name[num]));
> > +	}
> > +    }
> >  }
> >  
> >  
> > -- 
> > 2.7.4

  reply	other threads:[~2016-04-14  9:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 16:39 [PATCH] localedate: LC_IDENTIFICATION.category: set to ISO 14652 2002 standard Mike Frysinger
2016-04-13 18:50 ` Chris Leonard
2016-04-13 18:57 ` Carlos O'Donell
2016-04-13 20:05   ` Mike Frysinger
2016-04-13 22:45   ` [PATCH] localedef: check LC_IDENTIFICATION.category values Mike Frysinger
2016-04-14  8:59     ` keld
2016-04-14  9:26       ` keld [this message]
2016-04-14 13:50         ` Mike Frysinger
2016-04-14 15:04           ` keld
2016-04-14 17:49             ` Mike Frysinger
2016-04-14 21:21     ` [PATCH v2] " Mike Frysinger
2016-04-15  4:44       ` Carlos O'Donell
2016-04-15 16:46         ` Mike Frysinger
2016-04-14 21:18 ` [PATCH v2] localedata: LC_IDENTIFICATION.category: set to ISO 30112 2014 standard Mike Frysinger
2016-04-15  4:44   ` Carlos O'Donell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160414092626.GB19618@www5.open-std.org \
    --to=keld@keldix.com \
    --cc=carlos@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).