Обсуждение: BUG #5674: initdb failed if path contains symlink

Поиск
Список
Период
Сортировка

BUG #5674: initdb failed if path contains symlink

От
"Itagaki Takahiro"
Дата:
The following bug has been logged online:

Bug reference:      5674
Logged by:          Itagaki Takahiro
Email address:      itagaki.takahiro@gmail.com
PostgreSQL version: 9.0.0 (32bit)
Operating system:   Windows 7 (64bit)
Description:        initdb failed if path contains symlink
Details:

Windows 7 supports symbolic links like UNIX,
but initdb cannot initialize a database cluster
if the path (-D) contains symlinks.

> mkdir D:\real
> mklink /D D:\link D:\real
> initdb -D D:\real\pgdata --encoding=UTF8 --locale=C
  => OK
> initdb -D D:\link\pgdata2 --encoding=UTF8 --locale=C
  => could not create directory "D:/link": File exists

Re: BUG #5674: initdb failed if path contains symlink

От
Itagaki Takahiro
Дата:
On Fri, Sep 24, 2010 at 3:01 PM, Itagaki Takahiro
<itagaki.takahiro@gmail.com> wrote:
> Windows 7 supports symbolic links like UNIX,
> but initdb cannot initialize a database cluster
> if the path (-D) contains symlinks.

The bug might come from the following bug by Microsoft:

http://connect.microsoft.com/VisualStudio/feedback/details/595553/stat-function-returns-error-for-directory-symbolic-links

Note that initdb in 8.4 worked expectedly because it is built with MSVC 2005,
but initdb in 9.0 won't work because built with MSVC 2008 :-( .

--
Itagaki Takahiro

Re: BUG #5674: initdb failed if path contains symlink

От
Magnus Hagander
Дата:
On Mon, Sep 27, 2010 at 12:05, Itagaki Takahiro
<itagaki.takahiro@gmail.com> wrote:
> On Fri, Sep 24, 2010 at 3:01 PM, Itagaki Takahiro
> <itagaki.takahiro@gmail.com> wrote:
>> Windows 7 supports symbolic links like UNIX,
>> but initdb cannot initialize a database cluster
>> if the path (-D) contains symlinks.
>
> The bug might come from the following bug by Microsoft:
> http://connect.microsoft.com/VisualStudio/feedback/details/595553/stat-fu=
nction-returns-error-for-directory-symbolic-links
>
> Note that initdb in 8.4 worked expectedly because it is built with MSVC 2=
005,
> but initdb in 9.0 won't work because built with MSVC 2008 :-( .

Ouch.

We could work around it in this place (we could specifically ignore
the "file exists" error on the mkdir call), I guess. But how likely is
that to bite us elsewhere then?

--=20
=A0Magnus Hagander
=A0Me: http://www.hagander.net/
=A0Work: http://www.redpill-linpro.com/

Re: BUG #5674: initdb failed if path contains symlink

От
Tom Lane
Дата:
Magnus Hagander <magnus@hagander.net> writes:
> On Mon, Sep 27, 2010 at 12:05, Itagaki Takahiro
> <itagaki.takahiro@gmail.com> wrote:
>> The bug might come from the following bug by Microsoft:
>>
http://connect.microsoft.com/VisualStudio/feedback/details/595553/stat-function-returns-error-for-directory-symbolic-links
>>
>> Note that initdb in 8.4 worked expectedly because it is built with MSVC 2005,
>> but initdb in 9.0 won't work because built with MSVC 2008 :-( .

> Ouch.

> We could work around it in this place (we could specifically ignore
> the "file exists" error on the mkdir call), I guess. But how likely is
> that to bite us elsewhere then?

That cure seems worse than the disease.  We don't have to support
symlinks in the datadir path; we do have to be sure that we're not
overwriting an existing DB.

I think this is a Microsoft bug and it's their problem to fix, not ours.

            regards, tom lane

Re: BUG #5674: initdb failed if path contains symlink

От
Itagaki Takahiro
Дата:
> Magnus Hagander <magnus@hagander.net> writes:
>> But how likely is that to bite us elsewhere then?

Initdb works well if the link is a junction (mklink /J).
We use junctions for tablespaces, but don't use symbolic links.
So, there are no problems unless users create symlinks by themselves.

On Mon, Sep 27, 2010 at 11:14 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I think this is a Microsoft bug and it's their problem to fix, not ours.

OK, but bad news is that the bug is in VC 2008, but they have not
fixed it even in VC 2010. I'm not sure they will fix it in the future...

--
Itagaki Takahiro

Re: BUG #5674: initdb failed if path contains symlink

От
Magnus Hagander
Дата:
On Tue, Sep 28, 2010 at 03:28, Itagaki Takahiro
<itagaki.takahiro@gmail.com> wrote:
>> Magnus Hagander <magnus@hagander.net> writes:
>>> But how likely is that to bite us elsewhere then?
>
> Initdb works well if the link is a junction (mklink /J).
> We use junctions for tablespaces, but don't use symbolic links.
> So, there are no problems unless users create symlinks by themselves.

Right. But the whole thing isn o problem unless the user creates a
symlink by themself, no?


> On Mon, Sep 27, 2010 at 11:14 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I think this is a Microsoft bug and it's their problem to fix, not ours.
>
> OK, but bad news is that the bug is in VC 2008, but they have not
> fixed it even in VC 2010. I'm not sure they will fix it in the future...

Yeah, that's always a problem with proprietary platforms :(

Should we publish a list of known issues that aren't in our hands
somewhere, like the wiki?

--=20
=A0Magnus Hagander
=A0Me: http://www.hagander.net/
=A0Work: http://www.redpill-linpro.com/

Re: BUG #5674: initdb failed if path contains symlink

От
Magnus Hagander
Дата:
On Tue, Sep 28, 2010 at 11:08, Magnus Hagander <magnus@hagander.net> wrote:
> On Tue, Sep 28, 2010 at 03:28, Itagaki Takahiro
> <itagaki.takahiro@gmail.com> wrote:
>> On Mon, Sep 27, 2010 at 11:14 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> I think this is a Microsoft bug and it's their problem to fix, not ours.
>>
>> OK, but bad news is that the bug is in VC 2008, but they have not
>> fixed it even in VC 2010. I'm not sure they will fix it in the future...

Actually, looking at the bug page the bug seems to have been reported
on sep 6th (or is that june 9th? depends on what date style they're
using). It might be too early to say they won't fix it - I'm not sure
they've even had a release since then?

--=20
=A0Magnus Hagander
=A0Me: http://www.hagander.net/
=A0Work: http://www.redpill-linpro.com/