From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Command-line parsing in pg_ctl is not portable |
Date: | 2004-10-26 04:00:33 |
Message-ID: | 200410260400.i9Q40XV04413@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Peter Eisentraut wrote:
> The command-line argument parsing in pg_ctl is not portable. This is the
> output on a glibc system:
>
> $ pg_ctl start stop
> pg_ctl: too many command-line arguments (first is "start")
>
> But:
>
> $ POSIXLY_CORRECT=1 pg_ctl start stop
> pg_ctl: too many command-line arguments (first is "stop")
>
> This is probably because GNU getopt rearranges the arguments, and since pg_ctl
> uses two while loops to try to allow non-option arguments before options,
> things may get reordered multiple times.
>
> Now this particular case is minor trouble, but I wonder in what other
> situations arguments will get reordered where the order does make a
> difference.
Yea, I found that GNU getopt reordering thing to be very strange. I can
imagine some risks to such reordering. Fortunately we don't have any
other commands where we have to do this weird double-calls.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Stark | 2004-10-26 05:17:40 | Re: [PATCHES] ARC Memory Usage analysis |
Previous Message | Bruce Momjian | 2004-10-26 03:52:45 | Re: Using ALTER TABLESPACE in pg_dump |