Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 08 Jun 2015 03:57:01 +0200
From: Harald Becker <ralda@....de>
To: musl@...ts.openwall.com
Subject: Re: Build option to disable locale [was: Byte-based C locale,
 draft 1]

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.