Hello, I am facing a very strange problem with chdir and GetCurrentDirectory. After calling chdir (), the call to GetCurrentDirectory () returns wrong value. I tested this on Windows 7 and Windows 2016. It is working fine on Windows 7 whereas wrong values are returned on Windows 2016. I guess we should see the same behavior on Windows 10 (client version of Windows 2016) as well.
######################################################################### Administrator@windows2k16vika /cygdrive/c/src $ cygcheck.exe -c cygwin Cygwin Package Information Package Version Status cygwin 1.7.33-1 OK Administrator@windows2k16vika /cygdrive/c/src $ uname -a CYGWIN_NT-10.0-WOW6 windows2k16vika 1.7.33-2(0.280/5/3) 2014-11-13 15:45 i686 Cygwin Administrator@windows2k16vika /cygdrive/c/src $ cat test_cwd.c #include <stdio.h> #include <unistd.h> #include <windows.h> #define BUF_SIZE 512 int main() { int ret; char *dir; char dirname [BUF_SIZE]; dir = "/cygdrive/c/Program Files"; ret = chdir (dir); fprintf (stderr, "chdir (%s) reuturned <%d>\n", dir, ret); ret = GetCurrentDirectory(BUF_SIZE, dirname); if (ret) fprintf (stderr, "GetCurrentDirectory returned <%s>, ret = <%d>\n", dirname, ret); dir = getcwd (dirname, BUF_SIZE); fprintf (stderr, "getcwd returned <%s>, ret = <%s>\n", dirname, dir); return 0; } Administrator@windows2k16vika /cygdrive/c/src $ gcc -g -Wall -lKernel32 test_cwd.c -o test_cwd Administrator@windows2k16vika /cygdrive/c/src $ ./test_cwd.exe chdir (/cygdrive/c/Program Files) reuturned <0> GetCurrentDirectory returned <C:\Pro>, ret = <6> getcwd returned </cygdrive/c/Program Files>, ret = </cygdrive/c/Program Files> Administrator@windows2k16vika /cygdrive/c/src $ ######################################################################### Has anyone noticed such behavior on Windows 10 or 2016? Any suggestions, pointers? Thanks, Dipak -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple