pgsql: Don't try to trim "../" in join_path_components(). - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Don't try to trim "../" in join_path_components().
Date
Msg-id E1SmtQ7-0008Gk-2H@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Don't try to trim "../" in join_path_components().

join_path_components() tried to remove leading ".." components from its
tail argument, but it was not nearly bright enough to do so correctly
unless the head argument was (a) absolute and (b) canonicalized.
Rather than try to fix that logic, let's just get rid of it: there is no
correctness reason to remove "..", and cosmetic concerns can be taken
care of by a subsequent canonicalize_path() call.  Per bug #6715 from
Greg Davidson.

Back-patch to all supported branches.  It appears that pre-9.2, this
function is only used with absolute paths as head arguments, which is why
we'd not noticed the breakage before.  However, third-party code might be
expecting this function to work in more general cases, so it seems wise
to back-patch.

In HEAD and 9.2, also make some minor cosmetic improvements to callers.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/85254199478bcf49d0ac83fdf22d6bcf35ceccb1

Modified Files
--------------
src/bin/initdb/initdb.c |    2 +-
src/bin/psql/command.c  |    6 ++--
src/port/path.c         |   53 +++++++++++++++++++++-------------------------
3 files changed, 28 insertions(+), 33 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Don't try to trim "../" in join_path_components().
Next
From: Bruce Momjian
Date:
Subject: pgsql: Fix PGDATAOLD and PGDATANEW to properly set pgconfig location, p