From: | "William ZHANG" <uniware(at)zedware(dot)org> |
---|---|
To: | "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: Bug in canonicalize_path() |
Date: | 2005-08-12 03:25:46 |
Message-ID: | 010401c59eed$911027c0$1504a8c0@wlzhang |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
I have test the following on Windows and Linux:
Windows:
C:\>cd Winnt
C:\WINNT>cd C:\Temp\..\..\
C:\>
Linux:
$ cd /usr/../../
$ pwd
/
We should handle this correctly.
1 Single dot in the path can be removed safety. (except the first one. e.g. ./usr/local)
2 Every double dot may need a removal of the last part of the path. (except the first one. e.g. ../local)
And if there are not enough part left, keep the last part as it is.
We can even make it easier by adding step 0: make sure path is an absolute path.
----- Original Message -----
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>
Sent: Friday, August 12, 2005 11:15 AM
Subject: Re: [PATCHES] Bug in canonicalize_path()
> Tom Lane wrote:
> > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > But what about "usr/local/../../.."?
> >
> > What about it? The case of /usr/local/../../.. is handled correctly,
> > and the case where it's an underspecified relative path doesn't seem
> > that interesting to me --- certainly that is not so important that we
> > should get the wrong answer on cases that *are* plausible.
> >
> > Most of the uses of canonicalize_path are on paths that are required to
> > be absolute, anyway.
> >
> > It wouldn't be too implausible to error out if pending_strips>0 after
> > exiting the loop.
>
> 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.
>
> --
> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2005-08-12 03:27:23 | Re: [HACKERS] For review: Server instrumentation patch |
Previous Message | Bruce Momjian | 2005-08-12 03:15:25 | Re: Bug in canonicalize_path() |