More on slot wrapper objects

Following up on the first installment :

Slot wrapper objects do not directly call the C functions that theywrap up. Instead they check that they are being called with a self argument that is an instance of the type that they are wrapping,create a 'method-wrapper' object with the self memorized, andcall that .

We're not done yet, because there is another level of indirection:instead of directly calling the C function, the method-wrapper objectcalls a generic handler function for the particular sort


Thinking about types of bugs (and static analysis)

Someone from Coverity recently gave a talkto the local Unix hacks group abouttheir static analysis tools, and in the process got me to thinking aboutthe different types of bugs that I see.

As a first approximation, I think that I can split relatively commonbugs into three different classes:

  • mistakes like using the wrong variable or off by one errors.
  • oversights like forgetting to free memory or unlock a lock under somecircumstances.
  • logic errors, where the code is accurately expressing your desire andyou got all the details right

What are slot wrapper objects?

I got curious about what 'slot wrapper' objects are after I encounteredthem in FindingMethodProviderII , so I went digging in the CPythonsource. It turns out that the answer requires understanding the internalstructure of CPython.

Python types written in C start with a big structure that definesvarious details about them, including a large number of pointers tofunctions that implement various basic operations such as deallocatingobjects of this type, getting and setting attributes, comparison, andso on. Many but not all of these correspond to Python level


A use for CSS adjacent selectors

CSS has a very complicated system of CSS selectors , which let you pick outjust what you are applying some (cascading) style to; they range fromobvious to what I consider obscure, such as adjacent sibling selectors.

(An adjacent sibling selector is written E + F ; it matches any Felement that is immediately preceded by an E element.)

It turns out that there is a straightforward use for them: interiormargins.

Suppose that you have a table where you want the cells in a horizontalrow to


Weekly spam summary on June 16th, 2007

This week, we:

  • got 10,437 messages from 238 different IP addresses.
  • handled 19,475 sessions from 1,336 different IP addresses.
  • received 213,499 connections from at least 71,964 different IPaddresses.
  • hit a highwater of 8 connections being checked at once.

This is down from last week on the absolutenumbers, but may be up somewhat if we exclude the effects of the oneprolific connector from last


Why I am in system administration instead of programming

One way to put it is that in system administration, an issue that takesall of your time and energy for a week is a big thing and one that takesa month is generally a crisis. The same generally cannot be said ofprogramming except at a very small level; while you may clearly be goingup steps, the top of the path is generally not in sight.

Or in other words, you accomplish visible things much faster in systemadministration, and this gives you real, tangible signs of progress and


Getting source RPMs with yumdownloader (part 2)

To follow up the first installment , it turns outthat enabling the source repositories has a side effect that I didn'tthink about at the time: it no longer looks in the default repositories.

(This is a general thing in yumdownloader : any time you specify arepository explicitly, it disables all the default ones. This makesme grumpy. While you can argue that this makes a sort of sense, itis not how yum itself behaves when you enable repositories, and yumdownloader uses the exact same command line


What NFS file-based locking problems can happen

Now that we know how NFS is unreliable , we cansee what can go wrong when you attempt to do file-based locking over NFS. There are two failures, corresponding tothe two ways for things to go wrong when a reply is lost:

  • if you lose the server's reply to a successful attempt to acquirethe lock, your replay of the operation will report a failure even thoughyou actually own the lock. The result is effectively a deadlockedsystem where the lock will never get released.

    (This


'Argument list too long' is a misleading message

If you try to run a command with too many command line arguments, youget an 'Argument list too long' error (technically you get an E2BIG error from the kernel, which is then mapped into this error string byyour shell). There's a bunch of workarounds for this problem, such asusing xargs .

However, the error message is actually somewhat misleading. As oldUnix hands know (and new ones generally don't), the kernel's sizelimit on exec(


Getting source RPMs with yumdownloader

In theory, the yumdownloader program that is part of the yum-utils package will download the source RPMs if you want it to. In practice Ispent a long time having it not work on my Fedora Core 6 machines, untilI read yet another bland bit of advice telling me to use it and decidedto figure out just what was going on.

(The problem was quite frustrating, because yumdownloader nevercomplained; it just silently did nothing.)

It turns out that the trick is that you need to specifically