mailing list of musl libc
 help / color / mirror / code / Atom feed
From: He X <xw897002528@gmail.com>
To: musl@lists.openwall.com
Subject: Re: Re: a bug in bindtextdomain() and strip '.UTF-8'
Date: Wed, 8 Feb 2017 18:13:30 +0800	[thread overview]
Message-ID: <CAPG2z08tv19E8VzDUYSG6uJqBBiHHuEUnK84WHudjSdQC-6vLg@mail.gmail.com> (raw)
In-Reply-To: <20170129163329.GL1533@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 2283 bytes --]

here the patch is: http://paste.ubuntu.com/23953329/
The code tested, but maybe it sucks.

1. striping @xx, _TT: when mapping with full name failed,  we check if
there's a '@' in locname. if so, go back to the part of copying catname,
override and skip '@xx'.

Then we check if there's a '_', and if both '@' and '_TT' is there, point
locname to '@xx', set a correct loclen, go back to the part of writing
locname to replace '_TT' with '@xx'. If not both, skip and simply override
'_TT'.

Because there's also '_' in 'LC_xx', we may get into a dead loop of
stripping '_TT'. So locname is checked, it's set to NULL if we used strchr
to skip once.

Same reason, we may get into a dead loop of overriding '_TT'. The first
position of '/' should be front of the '_' if we replaced it once, the name
will like: 'zh@t/LC_xx'.

zh_CN@t (stripped by the first part)-> zh_CN (overrided by the second
part)-> zh@t  (stripped by the first part again)-> zh

2. about rewriting of '.GBK': I agreeded with keeping the original value
 of user, and stripping it in gettext() before. But i thought that someone
may validate if libc set the correct charset by setlocale(). So we should
rewrite .XX to .UTF-8 in setlocale(), we cant return a wrong value in
principle.

2017-01-30 0:33 GMT+08:00 Rich Felker <dalias@libc.org>:

> On Mon, Jan 30, 2017 at 12:14:49AM +0800, He X wrote:
> > I can't wait, can i work on it and make a patch for these issues if
> Masanori
> > Ogino is busy now? I'd like to see that these issues could be solved in
> > official musl repo as soon as possible.
>
> I'm not saying you need to wait, just that you should be aware of past
> discussion of the topic, and if you want to propose patches they
> should either follow the behavior outlined before or come with
> discussion of why you think a different behavior is more appropriate.
>
> > And maybe rejection for NON-UTF-8, since 'LANG=zh_CN.GBK ./a.out(
> > setlocale(LC_*, "") )' showed me a segfault with glibc.
>
> I don't think "it crashes on glibc" is a good justification for
> anything. Rather there should probably be UX discussions of what
> different choices mean for different poor-configuration situations
> that are likely to arise in the wild (from things like LC_* getting
> copied over ssh).
>
> Rich
>

[-- Attachment #2: Type: text/html, Size: 3184 bytes --]

  reply	other threads:[~2017-02-08 10:13 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-20 11:25 He X
2017-01-29  4:52 ` He X
2017-01-29 13:39   ` Szabolcs Nagy
2017-01-29 14:07     ` Rich Felker
2017-01-29 14:48       ` He X
2017-01-29 15:55         ` Rich Felker
2017-01-29 16:14           ` He X
2017-01-29 16:33             ` Rich Felker
2017-02-08 10:13               ` He X [this message]
2017-02-08 14:31                 ` Rich Felker
2017-02-09  9:49                   ` He X
2017-02-11  2:36                     ` Rich Felker
2017-02-11  6:00                       ` He X
2017-02-11 23:59                         ` Rich Felker
2017-02-12  2:34                         ` Rich Felker
2017-02-12  6:56                           ` He X
2017-02-12  7:11                             ` He X
2017-02-13 17:08                             ` Rich Felker
2017-02-13  8:01                           ` He X
2017-02-13 13:28                             ` Rich Felker
2017-02-13 14:06                               ` He X
2017-02-13 17:12                                 ` Rich Felker
2017-03-04  8:02                                   ` He X
2017-03-17 19:27                                     ` Rich Felker
2017-03-17 19:37                                       ` Rich Felker
2017-03-18  7:34                                         ` He X
2017-03-18 12:28                                           ` Rich Felker
2017-03-18 13:50                                             ` He X
2017-02-13 14:12                               ` He X
2017-02-13 17:13                                 ` Rich Felker
2017-01-29 16:37         ` Rich Felker
2017-01-30  0:37           ` He X
2017-01-30 14:17           ` He X
2017-01-29 16:40         ` Szabolcs Nagy
2017-01-29 16:49           ` Rich Felker
2017-01-30 12:36             ` He X
2017-01-30 13:05               ` Szabolcs Nagy
2017-01-30  1:32           ` He X

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=CAPG2z08tv19E8VzDUYSG6uJqBBiHHuEUnK84WHudjSdQC-6vLg@mail.gmail.com \
    --to=xw897002528@gmail.com \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).