Josh Kupershmidt <schmi...@gmail.com> writes:
> On Tue, Jul 3, 2012 at 11:41 PM, Tom Lane <t...@sss.pgh.pa.us> wrote:
>> The get_parent_directory() call reduces "foo.sql" to an empty string,
>> which seems a tad bogus --- wouldn't "." be better?  But in any case,
>> join_path_components() thinks it can process a "../" prefix of the
>> tail argument by stripping a directory name from the head argument,
>> and there's nothing there to strip.  So IMO join_path_components()
>> is flat-out broken when applied to a non-absolute head path.
>> Not sure about what a useful solution would be.

> I may not have time to look at this today, but I think this behavior
> worked fine in the last version[1] of Gurjeet's \ir patch which I
> reviewed, which had different behavior for pathname normalization than
> what got committed.
> [1] 
> http://archives.postgresql.org/message-id/BANLkTi=eW_nUH9195=9upqf7treg4uh...@mail.gmail.com

[ looks at that... ]  Well, I can certainly see why Robert got rid of
that kluge in favor of using the path-manipulation functions we already
have.  It looks like most of the existing uses of join_path_components
are using absolute paths (eg, the result of getcwd), which probably
explains why we've not previously noticed that it's not working
correctly in such cases.

On reflection I think that what we need to do is fix it so that it only
strips "../" from the tail string when there is a directory name
available to be stripped from the head string.  Otherwise just stop
trimming.

                        regards, tom lane

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

Reply via email to