haskell / unix

POSIX functionality
https://hackage.haskell.org/package/unix
Other
107 stars 92 forks source link

Should `mkstemp` use `throwErrnoIfMinus1Retry` instead of `throwErrnoIfMinus1`? #282

Closed sol closed 11 months ago

sol commented 1 year ago

https://github.com/haskell/unix/blob/dc91c94e6231ca7ac9ae0214956b30089b6b0def/System/Posix/Temp/PosixString.hsc#L65 Should this be throwErrnoIfMinus1Retry?

mkstemp can fail with the same errors as open, which in turn can fail with EINTR. The man pages say that this can happen for "... slow device (e.g., a FIFO ...". So maybe we are good, not sure.

hasufell commented 1 year ago

I guess that's right.

vdukhovni commented 1 year ago

But mkstemp(3) does not open existing files, it only creates new files in directories, and its documentation on both Fedora 36 and FreeBSD 12 makes no mention of EINTR. It uses open with O_CREAT|O_EXCL, so not subject to blocking opening FIFOs, or similar.

I am not convinced this change is needed. It is unclear that we really should be retrying on a caught signal in this case. Barring a specific use-case that motivates the change, I'd hold off on fixing behaviour that isn't clearly broken.

vdukhovni commented 11 months ago

If there are no objections, we should close this issue as "Won't Fix".