CFT: new BSD-licensed sort available

Oleg Moskalenko oleg.moskalenko at
Thu Mar 15 01:19:44 UTC 2012

This is true, debians do the symlinks trick.

In Ubuntu :

/usr/bin/java -> /etc/alternatives/java
/etc/alternatives/java - >/usr/lib/jvm/java-6-openjdk/jre/bin/java


From: Jonathan Anderson [mailto:jonathan.anderson at]
Sent: Wednesday, March 14, 2012 3:14 PM
To: Adrian Chadd
Cc: Gabor Kovesdan; freebsd-current at; Oleg Moskalenko; freebsd-ports at
Subject: Re: CFT: new BSD-licensed sort available

On 14 Mar 2012, at 21:10, Adrian Chadd wrote:

This makes me think of the whole debian-y way of replacing the mailer
programs using some magic alias program.

So you could intall gnusort, bsdsort, and then some config file would
determine which was used.

'sort' would then be a symlink to said magic program, that'd look at
its argv[0], look at the contents of that file, and exec() the right

In fact, the runtime behaviour of the Debian "alternatives" system is simpler than that:

The custom Perl script with a config file is used to set up symlinks, which at runtime are... well, just symlinks. For instance, /usr/bin/vim is a symlink to /etc/alternatives/vim, which is itself a symlink to a binary like vim.gtk (example shamelessly stolen from the linked page, since I no longer have any Debian boxes to check for myself on :). No magic binaries or argv[0] fu.

In one way, it's an elegant solution. On the other, it's a classic example of Wheeler's Law in action. :)

Jonathan Anderson

Research Student, Security Group
Computer Laboratory
University of Cambridge

+44 (1223) 763747
jonathan.anderson at<mailto:jonathan.anderson at>

More information about the freebsd-ports mailing list