Re: Bug in canonicalize_path()

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: William ZHANG <uniware(at)zedware(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Bug in canonicalize_path()
Date: 2005-08-12 04:51:13
Message-ID: 200508120451.j7C4pDm02199@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > I figured it would be best to leave it alone if we can't process it, but
> > if you think it is more imporant to trim in cases like ../.., go ahead.
>
> My recollection of this patch:
>
> 2004-08-09 16:20 tgl
>
> * src/: port/exec.c, port/path.c, bin/initdb/initdb.c:
> Path-mangling logic was failing to account for paths containing
> mentions of '.' or '..'. Extend canonicalize_path() to trim off
> trailing occurrences of these things, and use it to fix up paths
> where needed (which I think is only after places where we trim the
> last path component, but maybe some others will turn up). Fixes
> Josh's complaint that './initdb' does not work.
>
> is that it's part of the API contract of canonicalize_path() that it
> will not return something with trailing "." or "..". It's not just
> neatnik-ism to strip those, it's necessary to allow higher-level
> path-mangling routines to reason about how to do what they need.
> The entire concept of "trim the last directory" fails if you have
> to account for "." or "..".

OK, new patch which I think handles all cases.

--
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

Attachment Content-Type Size
unknown_filename text/plain 1.7 KB

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-08-12 05:14:22 Re: remove BufferBlockPointers for speed and space
Previous Message Tom Lane 2005-08-12 03:39:21 Re: Bug in canonicalize_path()