[Haskell-beginners] a way to check whether a file is actually being written on
Silent Leaf
silent.leaf0 at gmail.com
Tue Jun 27 19:42:03 UTC 2017
Hi,
i created a small clone of dd in haskell. I made it so it only copies block
by block and only if there's any difference between each pair of blocks
from each file. the idea is to use this dd clone as backup system,
especially since my partitions are nearly full, so no real loss in copying
the whole things.
I'm wondering if there's any way to check if my program never ever writes
onto the target unless actually needed. obviously by reading the code i'd
say it does what i want, but we do make test cases rather than rely on what
we think the code does.
i can't run it with a target file that would be made read-only in the
filesys (and hope for an error for trying to write on it) since obviously i
need to open it in read-write right from the beginning, in case of actual
need of writing (as apparently i can't have two handles on the same file...
although maybe there's a way to change the mode of opening on the run? did
not find it in System.IO nor in Hoogle or Hayoo)
so if anyone has an idea, in or outside of haskell, that would be great!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20170627/cd198728/attachment.html>
More information about the Beginners
mailing list