Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Mar 2012 18:19:35 -0700
From:      Oleg Moskalenko <oleg.moskalenko@citrix.com>
To:        'Jonathan Anderson' <jonathan.anderson@cl.cam.ac.uk>, Adrian Chadd <adrian@freebsd.org>
Cc:        "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>, Gabor Kovesdan <gabor@freebsd.org>, "freebsd-ports@freebsd.org" <freebsd-ports@freebsd.org>
Subject:   RE: CFT: new BSD-licensed sort available
Message-ID:  <031222CBCF33214AB2EB4ABA279428A30107B5E9D2A3@SJCPMAILBOX01.citrite.net>
In-Reply-To: <ACA5E377-BFF9-4C1D-8499-A8003FFE79B3@cl.cam.ac.uk>
References:  <4F60C059.7060904@FreeBSD.org> <CAJ-VmokUV8t3W4CueZuiZC7e=FuVtFu1jq54V_NpRc79-3QG=w@mail.gmail.com> <ACA5E377-BFF9-4C1D-8499-A8003FFE79B3@cl.cam.ac.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
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

Oleg

From: Jonathan Anderson [mailto:jonathan.anderson@cl.cam.ac.uk]
Sent: Wednesday, March 14, 2012 3:14 PM
To: Adrian Chadd
Cc: Gabor Kovesdan; freebsd-current@freebsd.org; Oleg Moskalenko; freebsd-p=
orts@freebsd.org
Subject: Re: CFT: new BSD-licensed sort available

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

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
one.

In fact, the runtime behaviour of the Debian "alternatives" system is simpl=
er 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 sym=
link to /etc/alternatives/vim, which is itself a symlink to a binary like v=
im.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<mailto:jonathan.anderson@cl.cam.ac.uk>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?031222CBCF33214AB2EB4ABA279428A30107B5E9D2A3>