Currently cygwin emulates* Linux (and most other POSIXish systems that I'm aware of) by allowing the current directory to be removed:
tony@saturn ~/dev/perl/git $ mkdir foo tony@saturn ~/dev/perl/git $ cd foo tony@saturn ~/dev/perl/git/foo $ rmdir ~/dev/perl/git/foo but is inconsistent after that: tony@saturn ~/dev/perl/git/foo $ pwd /home/tony/dev/perl/git/foo tony@saturn ~/dev/perl/git/foo $ cd ~/dev/perl/git/foo bash: cd: /home/tony/dev/perl/git/foo: No such file or directory tony@saturn ~/dev/perl/git/foo $ cd ~/dev/perl/git tony@saturn ~/dev/perl/git $ ls foo ls: cannot access 'foo': No such file or directory The pwd isn't (only) the shell caching the current directory: tony@saturn ~/dev/perl/git $ cat 132648.c #include <stdio.h> #include <unistd.h> #include <sys/stat.h> #include <sys/types.h> int main(void) { char buf[1000]; /* keeping this simple */ if (mkdir("foo", 0700) < 0) { perror("mkdir"); return 1; } if (chdir("foo") < 0) { perror("chdir"); return 1; } if (rmdir("../foo") < 0) { perror("rmdir"); return 1; } if (!getcwd(buf, sizeof(buf))) { perror("getcwd"); return 1; } puts(buf); return 0; } tony@saturn ~/dev/perl/git $ cc -o132648.exe 132648.c tony@saturn ~/dev/perl/git $ ./132648 /home/tony/dev/perl/git/foo On Linux that program outputs: tony@mars:.../newlib/git$ ./132648 getcwd: No such file or directory Is that inconsistency with other platforms intentional? If it isn't, are there any plans to make it consistent with Linux/other POSIX-like systems? Note: I'm not requesting this be fixed. I have perl test code that needs to be skip the test with the current behaviour, or allow execution if the behaviour is made more consistent. Thanks, Tony If it matters: tony@saturn ~/dev/perl/git $ uname -a CYGWIN_NT-6.1-WOW saturn 2.9.0(0.318/5/3) 2017-09-12 10:41 i686 Cygwin * Win32 doesn't allow removing the current directory: C:\Users\tony>.\132648 rmdir: Permission denied -- 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