Unix portability and scripting language versions

By and large it's not too difficult to write portable Unix shell scripts(at least once you burn your fingers a time or two, and it helps tohave one of the old-fashioned Unixes around so you get that experienceearly). But here's something that I've been thinking about recently:the portability issue of scripting language versions.

It's not news that these days an increasing amount of programmingis being done not in the Bourne shell but in the various scriptinglanguages such as


It's sinking in that Sun is gone

I know, I'm behind the times, but it is slowly sinking in to me that Sunis gone; that Sun Microsystems, the company of Andy Bechtolsheim andBill Joy, the source of NFS among so many other things, is no more. Whatpieces of it survive are parts of a software company.

I'm sad about this not so much because of the end of Sun the company,but because it underlines the end of an era: Sun was the last survivor,in a way the


Viral marketing versus word of mouth marketing

Here's something it's time to say outright.

If you're getting the impression from previous entries that you can't have any fun any morewith all of those viral marketing tricks that people are so fond of,you'd be correct. Viral marketing is one of those poisoned well ideas,like affiliate marketing ; too manyspammers have hit too many people and systems for you to do it unlessyou are really good at doing it very lightly.

(You can get a certain amount of


Using socket.getaddrinfo to look up IP addresses

As sort of promised in the last entry , here'sthe Python code to look up IPv4 and IPv6 addresses for a host, using getaddrinfo() . As usual, this is condensed for WanderingThoughts and omits a modicum of error checking.

import socket
def gethostips(host, type=None):    ips = set()    if type:        types = (type,)    else:        types = (socket.AF_INET,                 socket.AF_INET6)    for t in types:        try:

Some notes on using socket.getaddrinfo()

Since I've been immersing myself in IPv6 I've naturally becomeinterested in finding out the IPv6 addresses of hosts, which means getaddrinfo() . In many ways, getaddrinfo() is a great API; it'swonderfully tuned for giving you exactly the information you need inorder to make connections to places. In other ways, it's less than idealand how to use its API is unclear.

(For the rest of this, I'm going to assume that you'


The purpose of configuration files

The common garden variety configuration file is generally terrible;hard to write, hard to read, and hard to use. That's because they'vegenerally been designed wrong, with the wrong purpose.

Much like programming languages, very few people create configurationsystems with the goal of communicating with both the program and otherpeople; instead they are almost always aimed just towards communicatingwith the program. When you are just communicating with the program, allsorts of things can be implicit , cryptic,and focused on the


A Linux gotcha about daemons and bindv6only

First, the brief review. Linux's net.ipv6.bindv6only sysctl controlswhether an IPv6 socket can also accept IPv4 traffic (with IPv4 mappedaddresses), or whether it binds only to true IPv6 traffic. So if youwant to turn off dual binding (which I think youshould), you turn this sysctl on and then run around fixing up things towork.

Except there's a gotcha. Whether IPv6 sockets can also talk IPv4 isactually a


IPv6 with Lighttpd on Linux

The situation with lighttpd is sufficiently complicated that I can'tcall it a brief note , so here's what I'veworked out. This is not necessarily valid for all distributions,since I'm working on Fedora 11.

Lighttpd is fully IPv6 enabled, but normally only binds its listeningsocket to the IPv4 address. Some distributions override this by settingthe server.use-ipv6 configuration option if IPv6 is enabled on themachine.

Now, server.use-ipv6


Brief notes on IPv6 support in some Linux programs

Lately, I've been trying to actually use IPv6. This is a good way to findout various annoying things about how well programs support it, and so I'mgoing to write down some notes about what I've found out so far.

  • tcpwrappers fully supports IPv6 based access restrictions, but not asnicely as it does IPv4 ones, and subnet-based restrictions have a lessconvenient notation. This is documented in the hosts.allow manpage.

    (And wow, have modern versions


Some stuff on dual-bound IPv6 sockets on Linux

One place where IPv4 mapped addresses show up a lot is the logs of Linux daemons that are running on machineswith IPv6 enabled. These days, it's reasonably popular for daemons tolisten (only) on an IPv6 socket for both IPv4 and IPv6 connections. Thekernel makes this work, using IPv4 mapped addresses for the IPv4connections, and then you get to find out which daemons choke anyways .

Not everyone likes the behavior where listening on a wildcard IPv6socket will get