pgsql: Code and docs review for multiple -c and -f options in psql.

Started by Tom Laneover 10 years ago4 messagescomitters
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

Code and docs review for multiple -c and -f options in psql.

Commit d5563d7df94488bf drew complaints from Coverity, which quite
correctly complained that one copy of each -c or -f string was being
leaked. What's more, simple_action_list_append was allocating enough space
for still a third copy of each string as part of the SimpleActionListCell,
even though that coding method had been superseded by a separate strdup
operation. There were some other minor coding infelicities too. The
documentation needed more work as well, eg it forgot to explain that -c
causes psql not to accept any interactive input.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/fcbbf82d2b6caf7b156f2ec35b322e23caf1e99e

Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 140 +++++++++++++++++++++++-----------------
src/bin/psql/startup.c | 93 ++++++++++++--------------
2 files changed, 121 insertions(+), 112 deletions(-)

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#2Michael Paquier
michael@paquier.xyz
In reply to: Tom Lane (#1)
Re: pgsql: Code and docs review for multiple -c and -f options in psql.

On Mon, Dec 14, 2015 at 4:52 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Code and docs review for multiple -c and -f options in psql.

Commit d5563d7df94488bf drew complaints from Coverity, which quite
correctly complained that one copy of each -c or -f string was being
leaked. What's more, simple_action_list_append was allocating enough space
for still a third copy of each string as part of the SimpleActionListCell,
even though that coding method had been superseded by a separate strdup
operation. There were some other minor coding infelicities too. The
documentation needed more work as well, eg it forgot to explain that -c
causes psql not to accept any interactive input.

- cell = (SimpleActionListCell *)
- pg_malloc(offsetof(SimpleActionListCell, val) + vallen + 1);
Thanks! Among all those things this bit is a bit shameful..
--
Michael

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#3Michael Paquier
michael@paquier.xyz
In reply to: Michael Paquier (#2)
Re: pgsql: Code and docs review for multiple -c and -f options in psql.

On Mon, Dec 14, 2015 at 11:16 AM, Michael Paquier wrote:

- cell = (SimpleActionListCell *)
- pg_malloc(offsetof(SimpleActionListCell, val) + vallen + 1);
Thanks! Among all those things this bit is a bit shameful..

(I am the one at the origin of that FWIW)
--
Michael

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#4Pavel Stehule
pavel.stehule@gmail.com
In reply to: Michael Paquier (#3)
Re: pgsql: Code and docs review for multiple -c and -f options in psql.

2015-12-14 3:16 GMT+01:00 Michael Paquier <michael.paquier@gmail.com>:

On Mon, Dec 14, 2015 at 11:16 AM, Michael Paquier wrote:

- cell = (SimpleActionListCell *)
- pg_malloc(offsetof(SimpleActionListCell, val) + vallen + 1);
Thanks! Among all those things this bit is a bit shameful..

(I am the one at the origin of that FWIW)

me too

Thank you

Pavel

Show quoted text

--
Michael

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers