Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 21 Sep 2020 01:53:31 -0500
From: "A. Wilcox" <awilfox@...lielinux.org>
To: musl@...ts.openwall.com
Subject: Re: Re: OS detection wrong on Alpine Linux 3.10

On 20/09/2020 14:21, Bruno Haible wrote:
> Rich,
> 
> POSIX — like many other standard — allows different implementations to
> behave differently. For example, iconv_open() and setlocale() behave
> differently in different POSIX-compliant libc implementations. This is
> OK. There is nothing wrong with it on either side.
> 
> Unit tests [1] need to take into account the actual behaviour of the
> software. It is normal that a unit test's core function produces a
> different result with musl than with glibc. The "expected outcome"
> part of the unit test, in this case, needs to be different. This is
> an actual, practical need to know whether the config triple ends in
> linux-gnu vs. linux-musl.


And then the tests break when glibc changes behaviour from one POSIX
conformant way to the other.  Or when musl changes behaviour.  etc.

As a distro packager: this sucks.  Don't do it.

Seriously.  Do not do it.

If a downstream needs to care about a behaviour of setlocale, they can
write an autoconf macro testing the behaviour, and then use that.  Then
when glibc and/or musl and/or FreeBSD and/or $platform_of_the_week
changes its behaviour, the test suite still passes without me having to
dive into horrible m4 code and making me extremely angry for a week.

I have seen this happen way too often, and it is always in GNU packages,
because you lot seem to think that libraries exist in a microcosm of
spacetime where their behaviours are static forever.  System libraries
evolve.  They evolve slower than others, but still a non-zero rate.

Note that there are plenty of GNU packages that actually use autotools
correctly, and they are a breath of fresh air, and they do not make me
afraid of building them.  Learn from them.  Be more like them.


>> There is one kinda legitimate purpose for detecting specifically musl:
> 
> It is not your role to tell us which code we write is "legitimate" and
> which code is not. I am a grown-up programmer.


Apparently not, or you would realise what you are doing is wrong, and
hurts your projects by making them infinitely harder to build than they
really need to be.  And that hurts you, and us (distros), and the people
who *use* your software.

Please, test behaviours, not library types.

Best,
--arw


> 
> Bruno
> 
> [1] https://en.wikipedia.org/wiki/Unit_testing
> 

-- 
A. Wilcox (awilfox)
Project Lead, Adélie Linux
https://www.adelielinux.org



Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

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.