[Haskell-beginners] a way to check whether a file is actually being written on

Jona Ekenberg saikyun at gmail.com
Tue Jun 27 20:42:53 UTC 2017


Den 27 juni 2017 9:47 em skrev "Silent Leaf" <silent.leaf0 at gmail.com>:

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!
______________________________

Maybe you can use strace? https://youtu.be/4pEHfGKB-OE


Beginners mailing list
Beginners at haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20170627/2cfdc1b0/attachment-0001.html>


More information about the Beginners mailing list