Backup MX for Mailman, with Exim

This week a hard disk from one of my servers broke. It has been replaced with just 3 minutes of downtime (kudos to OVH), and right now the RAID array is being rebuilt.

Since this is the first time this happens to me, and the server is running a production mailman service, I decided to take my time and set-up a backup MX server. This is how I did it.

Remember that I am using a Gentoo distribution, this may be slightly different in other distro. Continue reading “Backup MX for Mailman, with Exim”

Gentoo: How to use Munin to monitor Mailman

Update 31/12/2012: Now this is a bit simpler, since bug 448414 has been fixed.

Before we start with the step-by-step procedure to get the mailman plug-in working, lets recall how to test a munin plug-in:

$ sudo munin-run mailman
posts.value 24
members.value 21892

The output above is what you should get once the mailman plug-in is correctly set-up. Continue reading “Gentoo: How to use Munin to monitor Mailman”

Gentoo: How to debug Exim

If you have some problem with exim, and the logs are not enough, edit the /etc/conf.d/exim file, and add the debugging option (-d):

# Command-line options for running exim
EXIM_OPTS="-bd -q15m -d"

Then restart exim:

# /etc/init.d/exim restart

The exim daemon will not be detached from the console, the debug information will be printed to the standard output. Good luck!

pygit2 v0.17.3 released

This should be the last release in the v0.17 series. The master branch has already been moved to be based in the libgit2’s development branch.

New in v0.17.3:

  • New Blob.size getter
  • New Repository.create_blob_fromfile method
  • Signature, now the time and offset parameters are optional
  • Improved diff support
  • Add pygit2.__version__
  • Optimize usage of Travis
  • Various fixes for the unit tests
  • Various documentation improvements

Thanks to Alex Chamberlain, Carlos Martín Nieto, Eric Davis, Eric Schrijver, Petr Viktorin, Ridge Kennedy and W. Trevor King.

CSS: Sticky footer

If you look around for a technique to get the footer stick to the bottom of the web page, you will find many variants on same theme (using absolute positioning, etc.). All have the same problem: the footer has fixed height, it does not grow with its content.

But there is one way to get a sticky footer of variable height, which is by the way much simpler than the other techniques. It involves using CSS tables. And here it is:

Have a nice read.

ikaaro 0.75 released

Almost two years have passed since the previous major release of the ikaaro web framework, and the itools library. The new release has tons of changes, so many I will not try to list them here.

This release is used by BePatient and some intranets.

I have labelled this release as beta, because the code to upgrade from the previous major release (0.62) is missing. Though, this is probably unfair since this version is already being used in production, and it is recommended to use it for new projects.

pygit2 v0.17.2 released

Just a week after the release of v0.17.1, here is v0.17.2, it fixes a single but rather important bug. The source distribution, as it was uploaded to pypi, was badly broken: it did not include fundamental files, so the package did not build at all. The problem was reported in issue 115

The bug was present forever actually, the MANIFEST file automatically generated by distutils did include everything, for instance test data files were missing. Things just get worse after the code refactoring that happened in v0.17.1

Now the file has been modified to generate the MANIFEST from Git itself, using git ls-files, so we don’t miss anything else again.

pygit2 0.17.1 released

pygit2 is a Python package that gives access to core features of the Git control version system. These features are implemented by the libgit2 shared library written in C, pygit2 is just a Python wrapper around this library.

The new version 0.17.1 of pygit2 adds several new features: support for diffs, the reflog and configuration files.

There has been too a huge code refactoring. Before the whole code was in a single C file of almost 4.000 lines of code, it has been split in several smaller files. Also pygit2 is now a package and contains a (for now empty) file, where we will add utility functions written in Python.

Other changes include improved support for Windows, and integration with Travis, a continuous integration service.

Several people has contributed to this new release, but Nico von Geyso deserves a special mention as the author of the code refactoring and of serveral new features.

Many thanks too to András Veres-Szentkirályi, Christian Boos, Martin Lenders, Petr Hosek and pistacchio for their contributions.

Gentoo: the HForge overlay

Just updated the ebuilds for itools and ikaaro in the hforge overlay, so I thought this is a good time to document how to use the hforge overlay.

Layman with Git support

If you have not installed layman yet, you have to, with the git use flag:

app-portage/layman git

Then emerge layman:

$ sudo emerge layman

Tell layman about the HForge overlay

Edit the /etc/layman/layman.cfg file:

overlays :

Add the HForge overlay

$ sudo layman -S
$ sudo layman -a hforge-overlay

Then edit the make.conf file:

source /var/lib/layman/make.conf

Test by emerging itools

Now you can test for instance by emerging itools. First unmask the package:

dev-python/itools ~amd64

Then emerge:

$ sudo emerge -p itools

Python: Running Valgrind on a C extension

This is how I use Valgrind to check for memory bugs in pygit2.

Glibc with debug symbols

The first issue I run into is that Valgrind refused to work if Glibc was not compiled with debug symbols.

This is how I did in my Gentoo notebook, I edited the /etc/make.conf file to enable the splitdebug feature:


Then re-emerged the glibc:

$ sudo emerge glibc

Then commented out the splitdebug feature to avoid emerging other packages with debug symbols (there is likely a better way to do this).

Valgrind 3.7

The big problem is that running Valgrind with a Python C extension raises tons of false positives. There are a number of things you need to do to avoid all these false positives.

The first one is to use latest version of Valgrind 3.7, because of some bug I forgot about present in version 3.6

Python, compiling for a memory debugger

Now, you need to install a version of Python to be used with Valgrind. There is one little change to do regarding an standard Python, edit file Objects/obmalloc.c and define Py_USING_MEMORY_DEBUGGER :


Now install as usual:

$ ./configure --prefix=~/Python-2.7.3-mem-debug
$ make
$ make install

The suppression file

Now you need to use the suppression file that you will find in the Python sources, at Misc/valgrind-python.supp. This is how I run the unit tests in pygit2 to find issues:

$ valgrind --trace-children=yes --suppressions=valgrind-python.supp \
~/Python-2.7.3-mem-debug/bin/python test

That’s it.