delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/12/29/16:41:49

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-Id: <200312292141.hBTLfFqd018662@guild.plethora.net>
From: seebs AT plethora DOT net (Peter Seebach)
Reply-To: seebs AT plethora DOT net (Peter Seebach)
To: cygwin AT cygwin DOT com
Subject: Re: Question about ash and getopts
In-reply-to: Your message of "Mon, 29 Dec 2003 13:32:28 PST." <3FF09D6C.7F12C5AC@dessent.net>
Date: Mon, 29 Dec 2003 15:41:15 -0600
X-IsSubscribed: yes

In message <3FF09D6C DOT 7F12C5AC AT dessent DOT net>, Brian Dessent writes:
>Peter Seebach wrote:
>> But, most importantly, it's in POSIX.  I can see no reason for /bin/sh to not
>> be at least reasonably close to a POSIX shell, when the code is already
>> written.

>I was looking at the POSIX specs, and while getopts is listed as a
>required utility[1], and it is listed in the table "regular built-in
>utilities"[2] it is not in the table "special built-in utilities."[3] 
>So, it looks like the command must be present but it does not
>necessarily have to be built into the shell.

Except that I don't think it can be implemented externally, because there's
no obvious way for it to set $OPTIND.

>> The "ash maintainer" is either me or Corinna.  FWIW, I don't plan on
>> changing this.  I want ash to be small and fast when running configure
>> scripts.  I've stripped ash down to support only the minimal set of
>> functionality found in older versions of UNIX.  I use the /bin/sh on
>> Digital UNIX 3.2 as a reference.

>> If you want more functionality, use bash.

>> FYI, getopts can also be a separate program although we don't supply it
>> with cygwin, currently.

That's the one I remember.  The problem is that configure scripts, however
common, are not the only kind of shell scripts out there, and getopts is a
very, very, important utility to have access to when writing portable scripts.

It's certainly very unfriendly to programmers, who may well want to write
portable scripts.  Having exactly one target where /bin/sh doesn't have
getopts is pretty awful.  "use bash" doesn't work portably - not everyone
ships with a /bin/bash, either.  :)

>So, it looks like cgf is the one you need to convince.  Perhaps show the
>running time differences of a long configure script with and without a
>getopts-enabled ash.  I have no idea what the differences may be, if
>any.

Intuition suggests there wouldn't be any measurable difference; there's no
mechanism for an unused feature to affect performance unless it's very
large.

-s

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019