[Haskell-beginners] a way to check whether a file is actually being written on
Silent Leaf
silent.leaf0 at gmail.com
Tue Jun 27 20:14:24 UTC 2017
by the way: dd has this option that says "in case of read error, do not
stop, continue". it's recomended to use it altho i never actually gotten
why.
my point is: how to handle any kind of read/write exception with my clone?
i used withBinaryFile which promised to close my handles no matter what,
which is great, but i don't feel much secured since i don't know how my
program would handle a bumpy ride or even if it would tell me anything... i
don't even know what would happen if it were cut in the middle, etc.
on this general topic, by the way, are there good resources for
system-programming with haskell? is it even manageable to do so rather than
use c-like (go, c++, etc) languages?
2017-06-27 21:42 GMT+02:00 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!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20170627/ff6e89df/attachment.html>
More information about the Beginners
mailing list