From owner-freebsd-ports@FreeBSD.ORG Thu Mar 15 01:19:44 2012 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E914106566C; Thu, 15 Mar 2012 01:19:44 +0000 (UTC) (envelope-from oleg.moskalenko@citrix.com) Received: from SMTP02.CITRIX.COM (smtp02.citrix.com [66.165.176.63]) by mx1.freebsd.org (Postfix) with ESMTP id A5B248FC1B; Thu, 15 Mar 2012 01:19:43 +0000 (UTC) X-IronPort-AV: E=Sophos;i="4.73,587,1325480400"; d="scan'208,217";a="186006432" Received: from sjcpmailmx02.citrite.net ([10.216.14.75]) by FTLPIPO02.CITRIX.COM with ESMTP/TLS/RC4-MD5; 14 Mar 2012 21:19:37 -0400 Received: from SJCPMAILBOX01.citrite.net ([10.216.4.73]) by SJCPMAILMX02.citrite.net ([10.216.14.75]) with mapi; Wed, 14 Mar 2012 18:19:36 -0700 From: Oleg Moskalenko To: 'Jonathan Anderson' , Adrian Chadd Date: Wed, 14 Mar 2012 18:19:35 -0700 Thread-Topic: CFT: new BSD-licensed sort available Thread-Index: Ac0CR4QCJ+mkrdXrTzOakoM5BzhhCQAAbabw Message-ID: <031222CBCF33214AB2EB4ABA279428A30107B5E9D2A3@SJCPMAILBOX01.citrite.net> References: <4F60C059.7060904@FreeBSD.org> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" 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" 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:19:44 -0000 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