From owner-freebsd-arch@FreeBSD.ORG Sun Mar 28 18:53:05 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7894316A4CE; Sun, 28 Mar 2004 18:53:05 -0800 (PST) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by mx1.FreeBSD.org (Postfix) with ESMTP id AB4AA43D1D; Sun, 28 Mar 2004 18:53:04 -0800 (PST) (envelope-from smckay@internode.on.net) Received: from dungeon.home (ppp190-27.lns1.bne1.internode.on.net [150.101.190.27])i2T2qsUK097541; Mon, 29 Mar 2004 12:22:55 +0930 (CST) Received: from dungeon.home (localhost [127.0.0.1]) by dungeon.home (8.12.8p2/8.11.6) with ESMTP id i2T2qosv004559; Mon, 29 Mar 2004 12:52:51 +1000 (EST) (envelope-from mckay) Message-Id: <200403290252.i2T2qosv004559@dungeon.home> To: Albert Cahalan References: <20040325070120.GA67497@VARK.homeunix.com> <1a9c01c41359$b3da45e0$7890a8c0@dyndns.org> <200403280808.i2S88aJ7016011@dungeon.home> <20040328184244.I10175@beagle.fokus.fraunhofer.de> <200403290042.i2T0g2sv003657@dungeon.home> <1080523435.2255.1869.camel@cube> In-Reply-To: <1080523435.2255.1869.camel@cube> from Albert Cahalan at "28 Mar 2004 20:23:56 -0500" Date: Mon, 29 Mar 2004 12:52:50 +1000 From: Stephen McKay cc: "Jacques A. Vidrine" cc: arch@freebsd.org cc: Garance A Drosihn cc: Stephen McKay Subject: Re: posix ps (was Re: Adding `pgrep' and `pkill' to /usr/bin) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2004 02:53:05 -0000 On Sunday, 28th March 2004, Albert Cahalan wrote: >On Sun, 2004-03-28 at 19:42, Stephen McKay wrote: >> On Sunday, 28th March 2004, Harti Brandt wrote: >> >> >Well, that is just like LANG or LC_ALL. You cannot depend on parsing >> >utility output until you set LC_ALL=C, yet I have still to see a script >> >that does this. >> >> Yes, that is a significant deficiency of the internationalisation scheme. >> That doesn't mean we should copy it though. > >At least this is proof that the idea is nothing crazy. I'm happy to agree that you disagree with me on this point. :-) >It has problems, but then so does everything else. In my mind it is one of those insidious problems that keeps giving you difficulties long after you thought you fixed them all. It's a bit like "const" in C, which looks like a great idea but which bites you over and over again. Hence the term "const poisoning". Perhaps there is a similar name for using environment variables to change the behaviour of existing utilities so that you can no longer predict their output in scripts. >Generally, no. You set the personality when you run >a large, complicated, or read-only script that expects >some non-default behavior. >Personality support is a compatibility hack. You use >it to make stuff work, not to break things. My fear (and expectation) based on experience with such things as Pyramid's dual unix personalities (and others) is that users will set every variable they can and to the weirdest of things. This forces every script to handle every possible variable. The people I worked with responded by locking everything down with huge numbers of hard-coded paths (to defeat the user selected unix personality). The possibility of having portable scripts disappeared. My hope is that reworking ps can introduce better portability, not harm it. >You have that flipped around. Personality support allows >you to make your old or foreign-OS scripts work. Repeating myself here, but I believe users will set the variable and that will break every script, so instead of this feature being used selectively to breath new life into old scripts, it will add a burden onto the authors of every new script. >You can get fancy. There are some tricks to make a >transition easier or more useful. For example, Linux >ps will give a warning and fall back to BSD mode if >the UNIX-style parser encounters problems. You can >allow mixed options; my users really like this. I'm happy for users to get whatever they like as long as use in scripts is completely predictable. Personally, I like it when "ps axl" and "ps -ef" do magic based on the hyphen. That's not a hidden variable though. >I'll end with a chunk of my man page. Please note the comment >"In general, it is a bad idea to set these variables." applying >to all environment variables (not just personality) and the >fact that the 4 non-POSIX personalities are marked with the >comment "(totally non-standard)" to warn the users. I think we've both got our arguments in front of everyone, so I probably won't counter your counter-counter arguments. :-) I'm not against you providing such a full featured universal ps command, but I don't think it is the right thing for /bin/ps in FreeBSD. Your "in general it is a bad idea" advice is much weaker than it should be though, and this is the core of my argument. I believe that every time you add a hidden parameter to a program you weaken its utility because using it portably, reliably and predictably becomes more difficult. It's the same argument I make against using global variables in subroutines. Stephen.