Re: Bug in canonicalize_path()

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Bug in canonicalize_path()
Дата
Msg-id 200508120239.j7C2dUF06142@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: Bug in canonicalize_path()  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Bug in canonicalize_path()  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Bug in canonicalize_path()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Yep, it is a bug on 8.0.X.  Are you suggesting a backpatch?  We can do
> > it.  Any objections?
>
> I think he's suggesting that we depend on GetFullPathName(), which seems
> a bit pointless considering we have to write the code anyway for other
> platforms.

Oh.

> I didn't much like the patch as-is; we should think a little harder
> about fixing the logic properly.

I thought about it.  Here is where we get stuck:

    usr/local/../../.. has to return  ..

Yuck.  If it an absolute path like /usr, you are fine.

In my first attempt, I counted the number of ".." groups, then went up
to remove each "..", and them remove a regular directory for each "..".
And then you have this case:

    /usr/local/../bin/../..

Here you hit the first ".." as you are going up.  It just seemed like a
lost cause.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

В списке pgsql-patches по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Bug in canonicalize_path()
Следующее
От: "uniware"
Дата:
Сообщение: Re: Bug in canonicalize_path()