haskell / haskell/unix

Unsafe usage of readdir_r

Open
#370 2 comments 0 reactions 0 assignees View on GitHub
status: needs triage type: bug
Dominant language
Haskell
Stars
124
Forks
99
PR merge metrics
No merged PRs in 30d

Description

When using `unix` on FreeBSD 15, we now get special warnings like these:

```
/usr/local/bin/ld: /home/ouranos/.ghcup/ghc/9.10.3/lib/ghc-9.10.3/lib/../lib/x86_64-freebsd-ghc-9.10.3-inplace/unix-2.8.7.0-inplace/libHSunix-2.8.7.0-inplace_p.a(HsUnix.p_o): in function `__hscore_readdir':
(.text+0x95): warning: warning: this program uses readdir_r(), which is unsafe.
/usr/local/bin/ld: /home/ouranos/.ghcup/ghc/9.10.3/lib/ghc-9.10.3/lib/../lib/x86_64-freebsd-ghc-9.10.3-inplace/unix-2.8.7.0-inplace/libHSunix-2.8.7.0-inplace_p.a(HsUnix.p_o): note: the message above does not take linker garbage collection into account
```

Not too sure if `unix` could put a warning on the function to propagate best practices, but I felt like you'd like to know. :)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the unix source entry point that implements __hscore_readdir and uses readdir_r, then reproduce the linker warning on FreeBSD 15. Determine how the unix package should address or report the unsafe usage; done means the reported warning is resolved or the intended warning behavior is established without changing directory-reading behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.