mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Harald Becker <ralda@gmx.de>
To: musl@lists.openwall.com
Subject: Re: Build option to disable locale [was: Byte-based C locale, draft 1]
Date: Mon, 08 Jun 2015 03:57:01 +0200	[thread overview]
Message-ID: <5574F66D.2070803@gmx.de> (raw)
In-Reply-To: <CAMAJcuC62F8jp76XFac-z505HUnJDkxFBzSw1D+VKK+0ws3Fxw@mail.gmail.com>

Hi Josiah !

On 08.06.2015 02:28, Josiah Worcester wrote:
> To start with: keep in mind that in the case of static linking most of
> this is not at all pulled in except when strictly necessary. Static
> linking might be more relevant to your needs.

You missed my lead in message: I don't talk about static linking (which 
is what I currently do, replacing other stuff). I'm looking for a really 
small shared C library.

As I think, the time for many different char sets is gone, we should 
step toward a small lib which fits better for two purposes:

1) really small systems with a minimal set of operation (usually those 
systems work with ASCII only, pure C locale).

2) Systems which use ASCII for it's majority, and use only a base set of 
UTF-8 operation.

This should be compatible for all systems using C locale, but does not 
fit full desktop system setups.

The problem is: Stripping all the functions on every new release is too 
much work, so it needs some minimal support in the library build 
process. Which should be pure optional, enabling the full version as 
default.

>>> - UTF-8 encoding and decoding
>> May be of use to keep, if on bare minimum.
>
> Seeing as the UTF-8 decoder is very small already, I'd be shocked if
> you could make an argument for removing that.

That's why I told "keep". I know it to be small, so keep it small and 
fast, and UTF-8 only (not supporting other multi byte char sets).

>
>>> - Character properties
>>
>>> - Case mappings
>>
>> Keep ASCII, map all none ASCII to a single value.
>
> This would be not-quite-right. Also, the case mapping tables are quite
> small. towctrans.lo which contains the case mappings is 1106 bytes.

Sorry for my poor English. I mean, let all functions behave as for 
locale "C" (ASCII), but don't fail / break when there is an embedded 
UTF-8 sequence. Just say "this is not ASCII" or may be: "this is UTF-8".


>>> - Internal message translation (nl_langinfo strings, errors, etc.)
>>
>>> - Message translation API (gettext)
>>
>> No translation at all, keep the English messages (as short as possible).
>
> musl does not have any translations in it at all. It only has a small
> portion of logic able to load external translations. locale_map.lo and
> __mo_lookup.lo which are together responsible for this, are a total of
> 1471 bytes.

I mean drop the portion to load external translations.

>>> - Charset conversion (iconv)
>>
>>
>> Copy ASCII / UTF-8, but fail for all other.
>
> Though quite possible, it's worth noting that musl iconv is not very
> large. iconv.lo is 128408 bytes, or 125k.

A big hunk to kick off. Just keep a stub that allows for ASCII and UTF-8 
and 1:1 copy operation. Should be possible to draw that down to not more 
than 1k.

> The regex equivalence classes are handled via the isw* functions which
> (as mentioned above) are quite small.

So handle them as for the "C" locale, but don't fail/break when someone 
enters an UTF-8 sequence.

> In short, it seems like if we made these changes we'd maybe be able to
> trim out 135k and almost all of that would be in iconv. Though I
> appreciate the desire for smaller code, this doesn't quite seem like
> the place to go looking.

My request is, to get a shared lib which does not need to include all 
that other char set and locale code. An optional build option, but with 
the need of some minimal support, so it can persist for future releases. 
I dislike doing all the strip down work over and over again for any new 
release.

The resulting library shall be standards conform and fully operational, 
as long as the applications only use the bare C locale, but should allow 
to pass through embedded UTF-8 sequences.

--
Harald



  reply	other threads:[~2015-06-08  1:57 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-06 21:40 [PATCH] Byte-based C locale, draft 1 Rich Felker
2015-06-06 22:39 ` Harald Becker
2015-06-06 23:10   ` Rich Felker
2015-06-06 23:59     ` Harald Becker
2015-06-07  0:24       ` Rich Felker
2015-06-07 23:59         ` Build option to disable locale [was: Byte-based C locale, draft 1] Harald Becker
2015-06-08  0:28           ` Josiah Worcester
2015-06-08  1:57             ` Harald Becker [this message]
2015-06-08  2:36               ` Rich Felker
2015-06-08  3:35                 ` Harald Becker
2015-06-08  3:51                   ` Josiah Worcester
2015-06-08  0:33           ` Rich Felker
2015-06-08  2:46             ` Harald Becker
2015-06-08  4:06               ` Rich Felker
2015-06-09  3:20               ` Isaac Dunham
2015-06-09  4:27                 ` Rich Felker
2015-06-07  1:17 ` [PATCH] Byte-based C locale, draft 1 Rich Felker
2015-06-07  2:50 ` Rich Felker
2015-06-13  7:06   ` [PATCH] Byte-based C locale, draft 2 Rich Felker
2015-06-16  4:26     ` Rich Felker
2015-06-16  4:35       ` Rich Felker

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=5574F66D.2070803@gmx.de \
    --to=ralda@gmx.de \
    --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).