Re: [Haskell-cafe] Taking over maintainership of cautious-file (or does anyone know of an alternative?)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [Haskell-cafe] Taking over maintainership of cautious-file (or does anyone know of an alternative?)

Niklas Hambüchen
Tangentially, note that `cautious-file` has drawbacks:

* It is not async-exception safe and may leak file descriptors. It uses `handleToFd` without proper exception handling (`bracket`).
* It does not `fsync` the directory in which the file is, meaning that you may still experience data loss on computer crashes.

`unliftio` provides actively maintained versions of most of what `cautious-file` does, addresses those drawbacks and is well-tested against crashes:

https://hackage.haskell.org/package/unliftio-0.2.12/docs/UnliftIO-IO-File.html

For example, `writeBinaryFileDurableAtomic`.

Niklas
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: [Haskell-cafe] Taking over maintainership of cautious-file (or does anyone know of an alternative?)

Brent Yorgey
Perfect, thanks!  I will try switching over to use unliftio.  Assuming it meets my needs --- and I see no reason why it won't --- I withdraw my intention to take over cautious-file.

-Brent

On Thu, Feb 13, 2020 at 10:43 AM Niklas Hambüchen <[hidden email]> wrote:
Tangentially, note that `cautious-file` has drawbacks:

* It is not async-exception safe and may leak file descriptors. It uses `handleToFd` without proper exception handling (`bracket`).
* It does not `fsync` the directory in which the file is, meaning that you may still experience data loss on computer crashes.

`unliftio` provides actively maintained versions of most of what `cautious-file` does, addresses those drawbacks and is well-tested against crashes:

https://hackage.haskell.org/package/unliftio-0.2.12/docs/UnliftIO-IO-File.html

For example, `writeBinaryFileDurableAtomic`.

Niklas

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries