From owner-cvs-src@FreeBSD.ORG Wed Jun 4 04:40:34 2008 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E12941065672; Wed, 4 Jun 2008 04:40:34 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.freebsd.org (Postfix) with ESMTP id 9B6C38FC12; Wed, 4 Jun 2008 04:40:34 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.2/8.14.2) with ESMTP id m544dtah038688; Tue, 3 Jun 2008 21:39:55 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.2/8.14.2/Submit) id m544dtfM038687; Tue, 3 Jun 2008 21:39:55 -0700 (PDT) (envelope-from sgk) Date: Tue, 3 Jun 2008 21:39:55 -0700 From: Steve Kargl To: Alexey Dokuchaev Message-ID: <20080604043955.GA38627@troutmask.apl.washington.edu> References: <200805301426.m4UEQ92d025434@repoman.freebsd.org> <48405C4B.3050603@FreeBSD.org> <1212179252.1967.1.camel@localhost> <20080604041815.GA84027@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080604041815.GA84027@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: Maxim Sobolev , src-committers@freebsd.org, Florent Thoumie , cvs-src@freebsd.org, cvs-all@freebsd.org, Coleman Kane Subject: Re: cvs commit: src/usr.sbin/pkg_install/add main.c pkg_add.1 src/usr.sbin/pkg_install/create main.c pkg_create.1 src/usr.sbin/pkg_install/delete main.c pkg_delete.1 src/usr.sbin/pkg_install/info main.c pkg_info.1 ... X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jun 2008 04:40:35 -0000 On Wed, Jun 04, 2008 at 04:18:15AM +0000, Alexey Dokuchaev wrote: > On Tue, Jun 03, 2008 at 04:18:23PM +0100, Florent Thoumie wrote: > > On Fri, May 30, 2008 at 9:27 PM, Coleman Kane wrote: > > > On Fri, 2008-05-30 at 12:58 -0700, Maxim Sobolev wrote: > > >> I am curious what is our policy on using long options in the base system > > >> (if any)? I believe that pkg_install is the first non-contributed base > > >> system utility to actually widely use it. For some reason I've got > > >> impression that use of getopt_long is considered "the Linux/GNU way", > > >> this API provided for compatibility purposes and its use in base system > > >> is discouraged. Quick grep through /use/src seemingly supports that. > > >> > > >> Can someone confirm/reject? > > > > > > I am not sure about policy, however I do appreciate the long options > > > sometimes. Primarily, I think they are useful (in a self-documenting > > > way) for use in shell scripts. I tend to prefer the single-char options > > > when I am doing the administration myself. > > > > I'm not aware of such policy. > > > > I think they're useful because as far as pkg_install is concerned, we > > are using single-char options that are hard to match to the action > > it's doing. Here are a couple examples: > > > > - pkg_create -h doesn't call usage() because it's already taken. > > - it's easy to confuse pkg_info -o and pkg_info -O. > > > > I'll back it out if general consensus is that long options should be avoided. > > I'd rather avoid long options in *BSD utilities. They're hard to > remember, easy to confuse, while not really gaining us anything useful > (IMHO of course). > I agree. The argument that long options are self-documenting in a script is rather weak. If the command isn't obvious, then script writer should actually put a comment in her code. The argument that -h is already taken and can't be used is also weak, because one can always do 'man pkg_create'. I personally believe that commit should be backed out and core should establish a policy against adding long options to BSD utilities. Of course, my vote doesn't really matter in that most of my attempted contributions to FreeBSD live in limbo. -- Steve