• Guessing Tcl/Tk configuration

    When a program uses Tcl and/or Tk, its configuration script (if any) has to check for the presence of these libraries and retrieve some information about them, such as their version, the required link flags, etc. Unfortunately, the process to achieve this is rather obscure (AFAIK), thus it is unknown by many people. This results in unportable (and broken) configuration scripts. So how is this done? Both libraries install a shell script which carries all the required information, so all you have to do is find the script, read it, and use the variables you need.

  • C++: Exceptions and destroyers

    If you use exceptions to signal errors in C++, you should be really careful when throwing an exception from inside a class' destroyer function, because you can easily cause an abort trap. Consider the following code: struct test { ~test(void) { throw int(0); } }; int main(void) { try { test t; throw int(1); } catch (int e) { } catch (...) { } return 0; } Trivial, isn't it? Well, now compile it and run it: you will get a "

  • Alternatives added to pkgsrc

    A few days ago (on the 25th), I finally added the alternatives framework to pkgsrc; haven't had a chance to write about it until now. The actual implementation is very different from what I had in mind when I started. It is composed of an independent utility, pkg_alternatives, and a make module, alternatives.mk. The later accomplishes perfect integration of the former with pkgsrc, so that the use of alternatives during package development is as painless as possible.

  • GNOME Panel easter eggs

    Today I reinstalled GNOME from scratch on my machine due to a mistake I made yesterday (which blew away half of it). After starting it, I saw a problem I had never noticed before. I have been able to solve it, although I haven't figured which is the root cause yet. Anyway, while looking for where the problem was, I discovered three easter eggs in the GNOME Panel module. If you don't like spoilers, stop reading now.

  • vr(4) problems

    Since I started using the vr(4) driver (i.e., when I switched my network to twisted pair cables), I've been experiencing very annoying crashes when running in promiscuous mode. This happened rarely at boot up, while dhclient(8) fetches its first lease. However, if you happen to use any other utility that puts the NIC in promiscuous mode, such as tcpdump(8) or bridge(4), the crashes happen almost 95% of the times. Yesterday, I got up decided to fix this issue (mainly because I need to set up a bridge).

  • Alternatives become wrappers

    Todd Vierling made some interesting suggestions about the alternatives stuff. I didn't like them at first, but the more I thought about them, the more I realized they were the way to go :-P So I've rewritten the alternatives framework almost from scratch, to make it use little wrappers instead of symbolic links (you can forget most things from the previous post, specially the example code). For those that don't know it, a wrapper is a little program that encapsulates another one; it does some preliminary tasks, but ends up running the program it's wrapping.

  • Alternatives system in pkgsrc

    Inspired by the recent comments of a user, I decided to implement an alternatives system for pkgsrc, similar to the one used by Debian. The purpose of this framework is to manage symbolic links that point to specific programs from a group of utilities with similar behavior. The easiest example to show what this means comes when looking at Vim and Nvi. Both editors can be generally installed on the same system without conflicts.