Older blog entries for mitr (starting at number 4)

Writing what is supposed to be a noddy program and finding a bug in glibc during the process does not happen every day :).

23 Feb 2004 (updated 24 Feb 2004 at 09:53 UTC) »

I have spent the weekend writing a GUI in Python. It's not too bad, but not that great either.

Using Python is quite easy and I'm sure I couldn't have written the same application in C as fast. The automatic memory management helps a lot too.

Fast as the development is, it is also quite painful for someone (me) used to static syntax and type checking. The ten edit-test cycles needed to fix a stupid error (defining a variable that shadows a built-in function) certainly were not faster than ten edit-compile cycles in C.

I'm also a bit worried about shipping an application without a way to make sure there are no "obvious" typos in the notoriously hard-to-test error-checking paths. Adrian probably knows what I mean.

And yes, I know about pychecker. It helps somewhat, but it executes all code outside of class definitions and class __init__ methods, which breaks horribly if the code fails a check and calls sys.exit.

Now that is an useful ChangeLog entry:

2004-02-01  somebody
        * project/*:
        * extra/*:
        * testing/*: Lots of bug fixes and improvements.
2003-09-29 somebody other

(details hidden to protect the guilty party).

Want some silly fun? Do a competition with your roommates in Minesweeper!

Out of curiosity I have checked all files that get bundled in a tarball of an autoconfiscated project. I haven't found anything interesting among them, but noticed gettext.h (copied from the gettext package, as suggested in the manual), which is under LGPL.

The project is licensed under OSL 2.0, so I got curious about the combination. LGPL paragraph 6 requires that with each binary of my project the distributor must "give prominent notice that the Library is used in it" ..., "supply a copy of this License", "include the copyright notice of the Library" and "a reference directing the user to the copy of this License".

So, apparently I can ship gettext.h in the tarball as long as I also ship COPYING.LIB. But anyone distributing a binary must make sure there is a "prominent notice" and modify the program to add the copyright notice for gettext and a pointer to COPYING.LIB. I ended up rewriting gettext.h from scratch; I don't want to "accidentaly" put such requirements on users of my software.

It gets worse, though. Reading /usr/include/string.h from glibc you see that if you compile with gcc -O (and don't define __NO_STRING_INLINES), #include <string.h> pulls also /usr/include/bits/string2.h, which contains very large inline functions that can not be considered trivial (due to the C aliasing model they can not even be written in strictly conforming C99). So any executable that uses the functions from glibc is clearly a derived work of glibc and falls under LGPL paragraph 6. (Even though LGPL paragraph 6 seems to indicate that they consider executables using shared linking to still be derived works of the library, I can imagine the judge would disagree; but the string inlines are not a case of shared linking.)

What does it mean? Since gcc is the canonical compiler on Linux, almost everybody is using optimization and almost every program calls memset (), strcpy (), strncpy () or strcmp () (this list is not exhaustive), almost any program for Linux distributed in binary form must be shipped acompanied with COPYING.LIB, must give a prominent notice it uses glibc and must contain the glibc copyright notice along with other copyright notices.

I find it quite surprising. In fact I don't know about any program that does that.

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!