Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid."

From: Huong Dangminh <huo-dangminh(at)ys(dot)jp(dot)nec(dot)com>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>, "Hiroshi Yanagisawa" <hir-yanagisawa(at)ut(dot)jp(dot)nec(dot)com>
Subject: Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid."
Date: 2016-01-20 08:22:08
Message-ID: 75DB81BEEA95B445AE6D576A0A5C9E9364CAE0B8@BPXM05GP.gisp.nec.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hi,

Thanks for reply sir,

>
> On 19 January 2016 at 18:49, Huong Dangminh <huo-dangminh(at)ys(dot)jp(dot)nec(dot)com
> <mailto:huo-dangminh(at)ys(dot)jp(dot)nec(dot)com> > wrote:
>
>
> Hi all,
>
> I have failed in execute initdb in "c:\Windows\Temp\dir" folder
> as
> reproduce logs below. The OS's messages "The current directory is
> invalid."
> was returned.
>
>
>
> Is that directory or any parent of it a junction point?
>
> http://www.nirsoft.net/utils/ntfs_links_view.html
>
>
> http://superuser.com/q/823959
>
>

No, sir. As my confirmed results below.

---
c:\>dir c:\Windows | find "Temp"
2016/01/08 11:55 <DIR> CbsTemp
2016/01/20 13:10 <DIR> Temp

c:\>dir c:\Windows\temp\ | find "dir"
2016/01/19 18:55 <DIR> dir

c:\>
---

> Also, why would you possibly run the installer from there? You should be
> using %TEMP% which should generally resolve to
> C:\Users\{Username}\AppData\Local\Temp or similar.
>

Yes, I think it should be %USERPROFILE%\AppData\Local\Temp
(we specified %TEMP% or %TMP% when create installer).
But in one of my customer's environment, it became "c:\Windows\Temp\ ".

>
> creating template1 database in c:/testdb/base/1 ... The current
> directory is invalid.
>
>
> It looks like somehow the current working directory is unmapped or cannot
> be found.
>
> Is there any chance you have mapped network drives in use?
>

No sir, I have only one drive (C) in reproduce environment.

I have tested some more case and found that,
In Windows2012, execute some command in folder which is subordinate
of "C:\Windows\TEMP\" with user that insufficient permission to
access that folder will produce this error.

initdb was executed with "Administrator" privileges, but
then initdb do popen() with none "Administrator" privileges
(by child process).
Child process not have enough privileges to access to
Current folder ("c:\Windows\Temp\dir"), so the
"The current directory is invalid." message was produced.

I found this phenomenon only in "C:\Windows\TEMP\" (Windows2012R2).

Best regards,
Dang Minh Huong
NEC Solution Innovators, Ltd.
http://www.nec-solutioninnovators.co.jp/en/

> --
>
> Craig Ringer http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Craig Ringer 2016-01-20 08:30:12 Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid."
Previous Message Craig Ringer 2016-01-20 06:05:14 Re: Window2012R2: initdb error: "The current directory is invalid."

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2016-01-20 08:26:15 Re: Stream consistent snapshot via a logical decoding plugin as a series of INSERTs
Previous Message Craig Ringer 2016-01-20 08:19:50 Re: Inconsistent error handling in START_REPLICATION command