mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Markus Wichmann <nullplan@gmx.net>
To: musl@lists.openwall.com
Subject: Re: Re: #define __MUSL__ in features.h
Date: Thu, 15 Mar 2018 22:06:19 +0100	[thread overview]
Message-ID: <20180315210619.wvx2ctu5cgsnxxii@voyager> (raw)
In-Reply-To: <CAFdMc-3Wifmb5TdoddYyzkBSxUSY1tVb_=vTs9OW93myXAA=CQ@mail.gmail.com>

On Thu, Mar 15, 2018 at 03:51:22PM -0300, dgutson . wrote:
> Fact #1: Software is not perfect. Bugs may show up. And sometimes in bad
> timing when doing a release.
> So, user developers have two options: hack the library with a workaround,
> and release with a
> hacked library untested and unverified by its supporting community, or they
> can leave the library as-is, and
> implement the workaround in the using code (which requires the macro in
> order to limit the impact to the library implementation).
> 

You know, you could just write your own macro, right? It doesn't have to
be __MUSL__, it could be called HAVE_BUGGY_SOMETHING, and it could be
defined in a config.h. And it is entirely up to you how it gets there.

Let's say musl had a bug in glob() somewhere. What you want to do is:

#ifdef __MUSL__
assume glob() is buggy
#else
use glob()
#endif

What Rich wants you to do is write a configure script that compiles a
program against the library, runs it and tests it output against two
alternatives. Then you can write

#ifdef HAVE_BUGGY_GLOB
assume glob() is buggy
#else
use glob()
#endif

The difference is about five minutes of work. And if you can't be
bothered to spend even those five minutes, you probably aren't going to
bother with the #ifdef stuff anyway. If it has to work HERE and NOW, you
just write the code conforming to the current situation. Might not work
tomorrow, but oh well, that's why it's called technical debt.

Oh, and if you're cross compiling, write a test program, run it on the
target, then create a config.h according to the results.

> Fact #2: Fixes take time, because community projects have their own agenda
> and triaging policies.
> 
> So, in the hypothetical bug of a library (no matter this particular case I
> referred to, there were, there are, and there will always be bugs)
> the macro will work as an escape hatch until the fix of the hypothetical
> bug is ready upstream.
> 

In a better world, that would be the case. In the real world, the
temporary solution is staying in place until it fails -- and it never
does. As soon as it works, you move on. Maybe the original author of the
workaround has left the company. Years later, some inquisitive soul will
ask why that #ifdef __MUSL__ strangeness is still in place, and no-one
will be able to answer, except with a cargo cult mentality. "Just let it
stay there, it doesn't hurt anything." Entire generations will grow up
reading that code and learning "musl has bug X", then move on to other
companies to spread the misinformation further. And all because you
couldn't be arsed to write a test!

I might have exaggerated a bit there.

> I'm writing this from a very practical and industry point of view (who have
> worked in FLOSS projects before and commercial projects).
> 

I have worked in embedded software for four years now, and what I have
seen does not inspire confidence in the continuous improvement processes
of the industry, to put it mildly.


Ciao,
Markus


      reply	other threads:[~2018-03-15 21:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-15 15:55 dgutson .
2018-03-15 18:39 ` Rich Felker
2018-03-15 18:48   ` Martin Galvan
2018-03-15 18:53     ` Rich Felker
2018-03-15 19:00       ` dgutson .
2018-03-15 19:13         ` dgutson .
2018-03-15 19:42           ` Rich Felker
2018-03-15 20:16           ` u-uy74
2018-03-15 20:44             ` u-uy74
2018-03-15 19:37         ` Rich Felker
2018-03-15 19:42           ` dgutson .
2018-03-15 19:02       ` Martin Galvan
2018-03-15 19:32         ` Rich Felker
2018-03-15 19:37           ` dgutson .
2018-03-15 19:43             ` Rich Felker
2018-03-15 19:52               ` dgutson .
2018-03-15 21:46           ` Szabolcs Nagy
2018-03-15 22:38             ` Rich Felker
2018-03-15 18:51   ` dgutson .
2018-03-15 21:06     ` Markus Wichmann [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=20180315210619.wvx2ctu5cgsnxxii@voyager \
    --to=nullplan@gmx.net \
    --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).