`readdir_r` is deprecated
When building GHC git HEAD on Debian Testing I get:
libraries/unix/cbits/HsUnix.c: In function ‘__hscore_readdir’:
libraries/unix/cbits/HsUnix.c:64:3: error:
error: ‘readdir_r’ is deprecated [-Werror=deprecated-declarations]
res = readdir_r(dirPtr, p, pDirEnt);
^~~
In file included from libraries/unix/include/HsUnix.h:71:0: error:
0,
from libraries/unix/cbits/HsUnix.c:9:
/usr/include/dirent.h:183:12: error:
note: declared here
extern int readdir_r (DIR *__restrict __dirp,
^~~~~~~~~
According to the man page:
This function is deprecated; use readdir(3) instead.
The readdir_r() function was invented as a reentrant version of readdir(3). It reads the next directory entry from the directory stream dirp, and returns it in the caller-allocated buffer pointed to by entry.
It is expected that a future version of POSIX.1 will make readdir_r() obsolete, and require that readdir() be thread-safe when concurrently employed on different directory streams.
In order to support all of the various *nix systems, we probably need to detect if readdir_r
is deprecated and only use readdir
where readdir_r
is in fact deprecated.
Trac metadata
Trac field | Value |
---|---|
Version | 8.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Core Libraries |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | ekmett |
Operating system | |
Architecture |