mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rob Landley <rob@landley.net>
To: musl@lists.openwall.com
Cc: musl@lists.openwall.com
Subject: Re: NULL
Date: Sat, 12 Jan 2013 00:32:44 -0600	[thread overview]
Message-ID: <1357972364.32505.4@driftwood> (raw)
In-Reply-To: <50ED726B.7010201@barfooze.de> (from maillist-musl@barfooze.de on Wed Jan  9 07:36:43 2013)

On 01/09/2013 07:36:43 AM, John Spencer wrote:
>> using NULL in the argument of variadic functions is ub both
>> in c and c++
> 
> many developers don't care about the standard. they take the stance:
> "works for me, if you want it patched then do it yourself and we'll  
> eventually merge"

Why is it UB? The standard says it's a pointer. If you pull %p off in  
printf, feeding NULL in that slot should work fine.

> yes, once you know the details, it's easy to fix.
> but when you don't, you'll have a hard time figuring out where the  
> segfault comes
> from. i agree that this should get more publicity.

"C++ is hard to debug and requires you to know how nested template  
expansion gets implemented down to the bare metal" is not a new problem.

Programming in C++ and hitting seemingly-trivial problems you can't  
debug without reading the compiler's source code is like riding a  
motorcyle and wind up with maimed for life. (There's a reason medical  
personnel call them "donorcycles".)

>> i think this is not needed, you can have a definition
>> in c++ that "happens to work" just like the (void*)0
>> in c:
>> 
>> #define NULL 0L
> 
> yes, that'll work as well.
> 
>> but this is just a workaround, the bugs still need to be fixed

It's not a workaround, it's what C99+LP64 explicitly specifies.

If doing something well-defined in C99 on Linux goes nuts on C++ in  
Windows, how is this our problem?

>> (in c++11 we could use nullptr which has std::nullptr_t type
>> which converts to (void*)0 in vararg context, but c++11 is not
>> widely used yet)

Is there actually a point to the C++1!!1one! standard? The only person  
I've heard actually be happy with it is the author of uClibc++, but he  
liked the previous C++ standards and thinks Corba is a good idea, so...

> well, from what i heard on IRC they started to work  on a musl port 2  
> weeks ago (but
> it got silent since...). since they have likely more packages than  
> sabotage (350)
> this issue could cause them major pain.

I wouldn't be too impressed by this.

There are somewhere between 200 and 900 packages that cross compile  
"easily", for a decreasingly obvious definition of "easily" depending  
on how many rocket engines you want to strap to the turtle. Projects  
like OpenEmbedded and Beyond Linux From Scratch recapitulate phylogeny  
with these packages, and then hit the point where your volunteers' time  
is entirely consumed dealing with package upgrades to hold the existing  
turf against bit-rot. (Personally, I refer to this as "the buildroot  
event horizon".)

Actual distributions eventually separate "the OS" from "the  
repository", where they have a core team who does work on the operating  
system and a separate (much, much larger) set of package maintainers  
who keep their packages of interest working but don't generally work on  
the base OS other than complaining when something breaks.

You only get to the "real distro" stage when the base OS stops being  
interesting. While the base OS remains a moving target, package  
maintainers can't do their jobs without also being OS maintainers,  
which is a much bigger time commitment and has Brooks' Law problems  
with coordination overhead scaling your core team.

There are plenty of existing interesting repositories: Debian, Ubuntu,  
Red Hat, SuSE, Gentoo... How much work do they do maintaining those  
repos? According to
https://admin.fedoraproject.org/pkgdb/stats/?_csrf_token=1048fa94db94990f5c39ed12c7ca4cd8cb840ca7  
Fedora has 150,000 packages (but then they break packages into several  
smaller packages for no apparent reason, and this may treat x86 and  
i686 versions of the same thing as separate packages). A much cleaner  
reading is "wget  
http://packages.debian.org/stable/allpackages?format=txt.gz -O - | zcat  
| wc -l" which gives around 35,000 packages. (You can get larger  
numbers by checking what ubuntu adds, looking at testing instead of  
stable, adding in the external repositories that debian's  
ultraconservative definition of "proprietary" kicks stuff to, and so  
on. But this is a good ballpark.)

A more recent attempt at being a real <strike>boy</strike> distro would  
be Arch Linux, and  
https://www.archlinux.org/packages/?sort=&arch=i686&q=&maintainer=&last_update=&flagged=&limit=50  
finds 4300 packages for the i686 target, and they've been doing this  
since 2002.

Reinventing the wheel because you have a new libc: not very  
interesting. Trying to get a musl version of debian or gentoo that you  
can push "upstream": a lot more interesting.

Rob

  reply	other threads:[~2013-01-12  6:32 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-09 11:02 NULL John Spencer
2013-01-09 12:18 ` NULL Szabolcs Nagy
2013-01-09 13:36   ` NULL John Spencer
2013-01-12  6:32     ` Rob Landley [this message]
2013-01-12  6:46       ` NULL Rich Felker
2013-01-12  7:15         ` NULL Luca Barbato
2013-01-12 13:33           ` NULL Rich Felker
2013-01-12 11:39       ` NULL Jens Staal
2013-01-09 13:09 ` NULL croco
2013-01-09 13:47   ` NULL John Spencer
2013-01-09 14:49     ` NULL croco
2013-01-09 14:42 ` NULL Luca Barbato
2013-01-09 14:47   ` NULL Rich Felker
2013-01-09 15:03     ` NULL Luca Barbato
2013-01-09 15:18     ` NULL John Spencer
2013-01-09 15:36       ` NULL Rich Felker
2013-01-09 21:11         ` NULL Rob
2013-01-09 21:53           ` NULL Szabolcs Nagy
2013-01-09 22:17             ` NULL Rob
2013-01-09 23:42         ` NULL Szabolcs Nagy
2013-01-12  6:56         ` NULL Rob Landley
2013-01-12  7:07           ` NULL Bobby Bingham
2013-01-12 13:31           ` NULL Rich Felker
2013-01-13 14:29             ` NULL Rob Landley
2013-01-13 14:56               ` NULL Luca Barbato
2013-01-13 16:29                 ` NULL Rob Landley
2013-01-13 17:14                   ` NULL Luca Barbato
2013-01-13 15:23               ` NULL Strake
2013-01-13 17:17                 ` NULL Luca Barbato
2013-01-13 17:47               ` NULL Szabolcs Nagy
2013-01-13 19:46                 ` NULL Rob Landley
2013-01-14  6:11                   ` NULL Rich Felker
2013-01-14  8:45                     ` musl as a framework to test applications' compatibility with POSIX (was: NULL) Vasily Kulikov
2013-01-14 14:03                       ` Rich Felker
2013-01-14 14:30                         ` Vasily Kulikov
2013-01-14 15:02                           ` Szabolcs Nagy
2013-01-14 15:14                           ` Rich Felker
2013-01-14 13:19                     ` NULL Rob Landley
2013-01-12  5:56 ` NULL Rob Landley
2013-01-12  6:42   ` NULL 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=1357972364.32505.4@driftwood \
    --to=rob@landley.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).