fpco / unliftio

The MonadUnliftIO typeclass for unlifting monads to IO
Other
151 stars 51 forks source link

`writeBinaryFile*Atomic` fails on PRoot environments running on AArch64 (ARM64) #107

Open francesquini opened 1 year ago

francesquini commented 1 year ago

System: Ubuntu 22.04, on a PRoot environment on AAch64. Unliftio v. 0.2.23.0

When I do:

module Main (main) where

import UnliftIO.IO.File
import Data.ByteString

main :: IO ()
main = do
  writeBinaryFile "writeBinaryFile.txt" bs
  writeBinaryFileAtomic "writeBinaryFileAtomic.txt" bs
  writeBinaryFileDurable "writeBinaryFileDurable.txt" bs
  writeBinaryFileDurableAtomic "writeBinaryFileDurableAtomic.txt" bs
  where
    bs = pack [65 .. 75]

I get 4 files, however, the ones using the atomic variant are empty:

emilio@localhost:~/testrio$ ls -l
total 1312
-rwxr-xr-x. 1 emilio emilio 1334440 Dec 28 15:18 testrio-exe
-rw-rw-r--. 1 emilio emilio      11 Dec 28 15:20 writeBinaryFile.txt
-rw-rw-rw-. 1 emilio emilio       0 Dec 28 15:20 writeBinaryFileAtomic.txt
-rw-rw-r--. 1 emilio emilio      11 Dec 28 15:20 writeBinaryFileDurable.txt
-rw-rw-rw-. 1 emilio emilio       0 Dec 28 15:20 writeBinaryFileDurableAtomic.txt

The same problem does not happen (i.e. it works as expected) when running the code on a regular virtualized environment on the same OS and hw architecture.

Any hints as to what might be happening?