The latest "stable coreutils release", 8.12, SKIPS a test it normally runs as part of its $ make check ... ./misc/pwd-unreadable-parent: skipping test: can't use buggy system getcwd SKIP: misc/pwd-unreadable-parent ....
Glibc should consider borrowing code from gnulib's getcwd() implementation, which is able to successfully determine working directories for several cases where the getcwd(2) syscall fails and where glibc currently doesn't try any harder: http://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/getcwd.c At one point, that code was forked from glibc, but gnulib's version has added additional improvements such as the use of openat() to get an answer in O(n) rather than O(n^2) time. Here's a sample program from gnulib that demonstrates a case of glibc giving up too easily: http://git.savannah.gnu.org/cgit/gnulib.git/tree/tests/test-getcwd.c You can demonstrate the glibc bug with that program (including building a needed <config.h> required by its #includes) by checking out gnulib.git, and running: ./gnulib-tool --with-tests --create-testdir --dir=path/to/dir getcwd cd path/to/dir ./configure gl_cv_func_getcwd_path_max=yes make check Omit the gl_cv_func_getcwd_path_max assignment during ./configure to let gnulib detect the limitation and use its fallback wrapper around glibc's getcwd.
Additionally, if the Linux kernel would ever properly support open(dir,O_SEARCH), then gnulib's getcwd() wrapper would work in even more cases.
I've updated git.