Re: pg_ctl - tighten command parameter checking

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_ctl - tighten command parameter checking
Date: 2002-02-18 22:52:03
Message-ID: 1014072724.4369.2016.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 2002-02-18 at 16:35, Peter Eisentraut wrote:
> Oliver Elphick writes:
>
> > The attached patch improves the command parameter checking of pg_ctl.
> >
> > At present, there is nothing to check that the parameter given with a
> > parameter-taking option is actually valid. For example, -l can be given
> > without a following logfile name; on a strict POSIX shell such as ash,
> > you will get a subsequent failure because of too many shifts, but bash
> > will let it pass without showing any error. The patch checks that each
> > parameter is not empty and is not another option.
>
> Isn't this problem present in all of our scripts?

Possibly, but this is the one where I had problems:-) I'll look at
others when I get some time.

> Btw., you shouldn't use "cut" in portable scripts. You could probably use
> "case" to do the matching you want.

What kind of an inadequate environment doesn't have cut?

OK. I'll redo it using case...esac.

NB. I saw a comment in this script about dirname's being non-portable.
But it uses basename. Is that portable?

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C

"All we like sheep have gone astray; we have turned
every one to his own way; and the LORD hath laid on
him the iniquity of us all." Isaiah 53:6

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-02-19 01:34:16 PostgreSQL talk at UWA
Previous Message David Terrell 2002-02-18 21:10:09 Re: Serious 7.2 issue (non quiet string truncation)