mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Christian Neukirchen <chneukirchen@gmail.com>
To: Rich Felker <dalias@libc.org>
Cc: musl@lists.openwall.com
Subject: Re: Revisiting byte-based C locale
Date: Fri, 05 Jun 2015 10:58:10 +0200	[thread overview]
Message-ID: <876172cz19.fsf@gmail.com> (raw)
In-Reply-To: <20150605013911.GT17573@brightrain.aerifal.cx> (Rich Felker's message of "Thu, 4 Jun 2015 21:39:11 -0400")

Rich Felker <dalias@libc.org> writes:

> On Thu, Jun 04, 2015 at 11:00:10PM +0200, Christian Neukirchen wrote:
>> Rich Felker <dalias@libc.org> writes:
>> 
>> > On Thu, May 21, 2015 at 10:22:03PM -0400, Rich Felker wrote:
>> >> Any new opinions on the topic? Or interest in re-emphasizing a
>> >> previously stated opinion? :)
>> >
>> > No new opinions on this? I've tentatively added drafting a new
>> > proposed byte-based C locale patch as a roadmap item for this release
>> > cycle, not necessarily to commit it, but as a way to re-evaluate
>> > whether it's still costly to implement.
>> 
>> Will it support regexec on 8-bit binary data?
>
> Yes, as long as the program has done one of the following:
>
> - Not called setlocale at all.
> - Called setlocale with an explicit "C" argument or in environment.
> - Called uselocale with a locale_t for "C".

AFAICS it does:

in main:
        (void)setlocale(LC_CTYPE, "");

protected int
file_regcomp(file_regex_t *rx, const char *pat, int flags)
{
#ifdef USE_C_LOCALE
        rx->c_lc_ctype = newlocale(LC_CTYPE_MASK, "C", 0);
        assert(rx->c_lc_ctype != NULL);
        rx->old_lc_ctype = uselocale(rx->c_lc_ctype);
        assert(rx->old_lc_ctype != NULL);
#endif
        rx->pat = pat;

        return rx->rc = regcomp(&rx->rx, pat, flags);
}


>> We found out file(1)
>> needs this.
>
> Indeed, aside from the Austin Group issue 663, having this topic come
> up several times in real-world usage is the motivation for
> reconsidering it. I believe file(1) _attempts_ to do this right,
> making use of uselocale.

A strong +1 from me then.  I'll be glad to help testing it on Void Linux.

-- 
Christian Neukirchen  <chneukirchen@gmail.com>  http://chneukirchen.org


      parent reply	other threads:[~2015-06-05  8:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-22  2:22 Rich Felker
2015-05-22  4:04 ` Josiah Worcester
2015-05-22  4:09   ` Rich Felker
2015-06-04 20:53 ` Rich Felker
2015-06-04 21:00   ` Christian Neukirchen
2015-06-05  1:39     ` Rich Felker
2015-06-05  4:48       ` Isaac Dunham
2015-06-05  8:58       ` Christian Neukirchen [this message]

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=876172cz19.fsf@gmail.com \
    --to=chneukirchen@gmail.com \
    --cc=dalias@libc.org \
    --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).