cosmopolitan/test
Justine Tunney 1eb6484c9c
Rewrite getcwd()
This change addresses a bug that was reported in #923 where bash on
Windows behaved strangely. It turned out that our weak linking of
malloc() caused bash's configure script to favor its own getcwd()
function, which is implemented in the most astonishing way, using
opendir() and readdir() to recursively construct the current path.

This change moves getcwd() into LIBC_STDIO so it can strongly link
malloc(). A new __getcwd() function is now introduced, so all the
low-level runtime services can still use the actual system call. It
provides the Linux Kernel API convention across platforms, and is
overall a higher-quality implementation than what we had before.

In the future, we should probably take a closer look into why bash's
getcwd() polyfill wasn't working as intended on Windows, since there
might be a potential opportunity there to improve our readdir() too.
2023-11-02 13:16:42 -07:00
..
dsp Fix warnings 2023-09-01 20:50:18 -07:00
libc Rewrite getcwd() 2023-11-02 13:16:42 -07:00
net Make improvements 2023-09-06 12:34:59 -07:00
tool Fix bugs and regressions in the pledge command 2023-11-01 06:08:58 -07:00
test.mk Support malloc() on bare metal 2021-02-24 00:53:24 -08:00