cosmopolitan/test/libc
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
..
calls Rewrite getcwd() 2023-11-02 13:16:42 -07:00
dns Improve threading and i/o routines 2023-10-12 23:13:04 -07:00
fmt Make improvements 2023-10-03 06:17:16 -07:00
intrin Introduce pthread_rwlock_try{rd,wr}lock 2023-10-31 22:13:08 -07:00
log Make improvements 2023-09-18 21:04:47 -07:00
mem Make improvements 2023-09-18 21:04:47 -07:00
nexgen32e Delete old wcwidth() implementation 2023-10-14 03:15:05 -07:00
proc Implement signal handler tail recursion 2023-10-14 10:38:15 -07:00
release Refactor fatcosmocc into a single file 2023-08-14 22:26:17 -07:00
runtime Revert "Rewrite ZipOS" 2023-10-03 14:40:03 -07:00
sock Fix the Landlock Make build 2023-10-14 10:40:05 -07:00
stdio Improve threading and i/o routines 2023-10-12 23:13:04 -07:00
str Delete old wcwidth() implementation 2023-10-14 03:15:05 -07:00
thread Introduce shm_open() and shm_unlink() 2023-10-31 23:57:52 -07:00
time Make improvements 2023-10-03 06:17:16 -07:00
tinymath Fix strtod NaN handling / fix SIGSEGV in testlib/showerror (#901) 2023-09-27 00:16:36 -07:00
x Make improvements 2023-09-18 21:04:47 -07:00
xed Make improvements 2023-09-06 12:34:59 -07:00
test.mk Make improvements 2023-09-18 21:04:47 -07:00