pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix our getopt_long's behavior for a command line argument of ju
Date: Mon, 23 Mar 2020 15:58:22 +0000
Message-ID: <E1jGPT4-0008K4-Mf@gemulon.postgresql.org> (raw)

Fix our getopt_long's behavior for a command line argument of just "-".

src/port/getopt_long.c failed on such an argument, always seeing it
as an unrecognized switch.  This is unhelpful; better is to treat such
an item as a non-switch argument.  That behavior is what we find in
GNU's getopt_long(); it's what src/port/getopt.c does; and it is
required by POSIX for getopt(), which getopt_long() ought to be
generally a superset of.  Moreover, it's expected by ecpg, which
intends an argument of "-" to mean "read from stdin".  So fix it.

Also add some documentation about ecpg's behavior in this area, since
that was miserably underdocumented.  I had to reverse-engineer it
from the code.

Per bug #16304 from James Gray.  Back-patch to all supported branches,
since this has been broken forever.

Discussion: https://postgr.es/m/16304-c662b00a1322db7f@postgresql.org

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ef7d6d79af43b168caf3ecc5847dcf47032b2253

Modified Files
--------------
doc/src/sgml/ref/ecpg-ref.sgml | 31 ++++++++++++++++++++++++++-----
src/port/getopt_long.c         | 14 +++++++++++---
2 files changed, 37 insertions(+), 8 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1jGPT4-0008K4-Mf@gemulon.postgresql.org>
Permalink:  ../E1jGPT4-0008K4-Mf@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jGPT4-0008K4-Mf@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix our getopt_long's behavior for a command line argument of ju
  In-Reply-To: <E1jGPT4-0008K4-Mf@gemulon.postgresql.org>
  References: <E1jGPT4-0008K4-Mf@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox