From owner-freebsd-ports@FreeBSD.ORG Thu Mar 15 01:04:03 2012 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4F6C31065673; Thu, 15 Mar 2012 01:04:03 +0000 (UTC) (envelope-from jonathan.robert.anderson@gmail.com) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by mx1.freebsd.org (Postfix) with ESMTP id 698F18FC12; Thu, 15 Mar 2012 01:04:02 +0000 (UTC) Received: by wibhj6 with SMTP id hj6so6579762wib.13 for ; Wed, 14 Mar 2012 18:04:01 -0700 (PDT) Received: by 10.180.99.100 with SMTP id ep4mr11089683wib.7.1331773441423; Wed, 14 Mar 2012 18:04:01 -0700 (PDT) Received: from joe.jonandchrissy?.ca ([85.210.163.42]) by mx.google.com with ESMTPS id l5sm873700wia.11.2012.03.14.18.03.59 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 14 Mar 2012 18:04:00 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1257) From: Jonathan Anderson In-Reply-To: Date: Wed, 14 Mar 2012 22:14:28 +0000 Message-Id: References: <4F60C059.7060904@FreeBSD.org> To: Adrian Chadd X-Mailer: Apple Mail (2.1257) Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-current@freebsd.org, Gabor Kovesdan , freebsd-ports@freebsd.org, Oleg Moskalenko Subject: Re: CFT: new BSD-licensed sort available X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Mar 2012 01:04:03 -0000 On 14 Mar 2012, at 21:10, Adrian Chadd wrote: > Hi, >=20 > This makes me think of the whole debian-y way of replacing the mailer > programs using some magic alias program. >=20 > So you could intall gnusort, bsdsort, and then some config file would > determine which was used. >=20 > '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 > one. In fact, the runtime behaviour of the Debian "alternatives" system is = simpler than that: http://segfault.in/2010/04/using-the-debian-alternatives-system/ 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. :) Jon -- Jonathan Anderson Research Student, Security Group Computer Laboratory University of Cambridge +44 (1223) 763747 jonathan.anderson@cl.cam.ac.uk=