Using content hashing to avoid the double post problem

For those who have not encountered it, the double post problem (orthe double comment problem) happens when your web system is just slowenough to respond that the user clicks 'Post ' again intheir browser and re-submits the same post/comment/what have you. In astraightforwardly implemented system, this results in a second copy ofthe comment or post appearing.

(This is of course a specific instance of a general double submissionproblem for all web forms.)

I worried about


In security, you need to stop the root mistake

Here is something that I have become more and more convinced of: if youwant to actually solve a security problem, you need to stop the rootmistake.

Many security problems have various surface issues that you can target,and then they have one (or more) root mistakes. It is tempting and easyto target surface issues, but if you do so you are not really solvingthe problem; you are simply causing the attackers to find another wayto create the circumstances where the root mistake will be committedagain


'Conditional restart' in init.d scripts can be dangerous

Yesterday, the lighttpd instance that I run on my workstation waseffectively down for about twelve hours; while the daemon was running,it was using the wrong configuration file and so it wasn't reallyserving anything. In turn, this happened because I installed a lighttpdpackage update, and as part of the post-update actions the package did' /etc/init.d/lighttpd condrestart '.

In theory, conditional restart in an init.d script will only restartthings if the init script has started


Modern version control systems change your directory layouts

We're in the process of a slow conversion from maintaining files withRCS to mostly keeping them in Mercurial repositories,which has wound up making me think about how we want to structure themand which of our existing directory areas are easy to convert. As aresult of this, I have an observation: modern whole-directory VCSeschange how sysadmins want to lay out files and directories.

In the old days of single-file version control, it made perfect sense togroup files together in directories by function or


Some notes for myself on git bisect

I know I'm late to the party on this one, but I just used gitbisect for the first time today in order to hunt down where akernel bug started showing up. Since there are more kernel bugs in my future, here are some things that I want toremember about the process and other random comments.

(I'll probably have more later when I do it again.)

First, I have to say that the whole process really is both cool andaddictive, and it works.


Why I love Unix, number N (for some N)

Suppose that you want to find all two and three digit primes where allof the component digits are also prime (eg, 37 would qualify but 41would not, since 4 is not prime).

Here is the simple Unix approach:

factor $(seq 10 999) | awk 'NF == 2 {print $2}' | egrep '^[12357]*$'

(I won't claim that this is obvious until you're immersed


An important lesson for me on Fedora upgrades

As I mentioned in a recent entry , Flash hasbeen broken for me for all of Fedora 11 on my 64-bit machine. Thecomments on my entry caused me to dig into the situation, and aftersome experimentation (building a fresh installed 64-bit Fedora 11 ina virtual machine to see if Flash worked, which it did), I found myproblem and now have working Flash.

In fact, I found the problem doing what I should have done in the firstplace;


My current unhappy thoughts on Fedora 12

Right now, I have two machines (a 64-bit desktop and a 32-bit laptop)at Fedora 11 and one (another 64-bit desktop) that's still backat Fedora 8. Upgrading to Fedora 12 soon is the obvious thing todo, since there are drawbacks to waiting too long to upgrade (although this is not an issue if you use PreUpgrade or yum -basedupgrades).

Except, well, I haven't been having the best of luck


Converting a directory from RCS to Mercurial

Suppose that you have a directory full of configuration files thathave been there for so long that they're still being maintained withRCS. Further suppose that you would like to change to a modern versioncontrol system, say Mercurial, but that you would like to preserve allof your old version history.

Mercurial has no direct support for converting RCS files, but there'sa magic trick: a CVS repository is nothing more than a bunch of RCSfiles in a directory hierarchy plus a thin layer of easily created


RCS versus modern version control systems

Here is something that may shock people: we're still maintaining systemsfiles with RCS .And I maintain that this is not as crazy as it sounds, once you digunder the surface, and that system administration is one of the lastplaces where RCS is sensible some of the time.

For all their myriad benefits, the drawback of modern version controlsystems is that they really want to be used on whole directories (ordirectory hierarchies). This is generally pretty okay for source code,where you have directories