From owner-freebsd-arch@FreeBSD.ORG Mon May 31 08:11:06 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 CCE7216A4CE for ; Mon, 31 May 2004 08:11:06 -0700 (PDT) Received: from ioskeha.hittite.isp.9tel.net (ioskeha.hittite.isp.9tel.net [62.62.156.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1BEF143D31 for ; Mon, 31 May 2004 08:11:06 -0700 (PDT) (envelope-from clefevre-lists@9online.fr) Received: from pc2k (200-62-118-80.kaptech.net [80.118.62.200]) by ioskeha.hittite.isp.9tel.net (Postfix) with SMTP id 457B017B577; Mon, 31 May 2004 17:11:43 +0200 (CEST) Message-ID: <05ff01c44721$7239cce0$7890a8c0@dyndns.org> From: "Cyrille Lefevre" To: , "Garance A Drosihn" References: Date: Mon, 31 May 2004 17:08:47 +0200 Organization: ACME MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1409 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Subject: Re: Change to "kludge option processing" in /bin/ps 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, 31 May 2004 15:11:07 -0000 "Garance A Drosihn" wrote: > After staring at the kludge-option processing in `ps' for awhile, I > found enough edge-cases where it simply did not work "right" (for my > definition of "right", at keast...), so I rewrote it. As part of that, > I also removed the ancient "BACKWARD_COMPATIBILITY" compile-time > option, where: > ps -options arg1 arg2 > (with no '-' on "arg1" and "arg2") was treated as: > ps -options -N arg1 -M arg2 how about to keep the historical compability if there is no `-' and to get rid of it if there is a trailing `-' ? > I did this because I have often been puzzled/annoyed when I type: > ps 12 > to get process 12, and then realize I wanted it shown in a > different format so I type: > ps -u 12 well, this should be fixed, but w/o breaking the historical compability. > and I get a completely different list of processes, or I type: > ps 12 34 old plain ps does not support multiple process IDs, the newer one would, at most, accept "ps '12 34'" or "ps '12,34'", but not "ps 12 34". > and I only see process 12, or I type > ps 12 34 56 > and get the error message: > ps: 56: No such file or directory > This BACKWARD_COMPATIBILITY is not documented in the usage() > or the man page, so I'd like to replace it. this is historical and should not be touch even if not documented, or better, this has to be documented. > So, I changed `ps' to check for any additional arguments after > processing all '-'-options, and if those start with a digit then > `ps' will try to use the entire argument as a pid or pidlist. > If an extra argument does not start with a digit, then `ps' just > prints an error and exits. so, the historical behaviour of ps will be broken :( > I want to do more testing on this before committing, but I thought > that all this was enough of a change that I should also give people > a chance to scream before I commit it. Also, I'm not sure if I > might have clobbered some subtle aspect of the kludge processing. before to commit new changes, think about how to fix the following ones :) # ps -p ,, PID TT STAT TIME COMMAND 0 ?? ZW 0:00.00 (sshd) # psx -p ,, psx: no process id specified # ps -p 1, PID TT STAT TIME COMMAND 0 ?? ZW 0:00.00 (sshd) # psx -p 1, psx: no process id specified PID TTY TIME COMMAND 1 ?? 00:00:07 init PS : as you can see, the changes I proposed does work in such cases :P also, what about the proposed changes I have submitted ? http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/65803 the next step will be the dynamic field sizing and probably the support of "-k sortlist" option, both from NetBSD. > If anyone wants to try the update, it is available at: > > http://people.freebsd.org/~gad/ps-kludge.diff > > [disclaimer: at the moment it's only had about 15 minutes of > testing, but I *think* this is about the way I want it to work] > > Assuming there aren't any major objections to these ideas, I plan > to do some more testing on this and commit it next weekend. as said before, I dislike the change as proposed, but would accept it w/ a little more work. Cyrille Lefevre. -- home: mailto:cyrille.lefevre@laposte.net