[Haskell-cafe] directory package copyFile error

Olaf Klinke olf at aatal-apotheke.de
Tue Mar 20 12:43:38 UTC 2018


Dear cafe, 

not sure whether this is a bug or misusage on my part:
I'm using stack lts-9.2, which entails directory-1.3.0.0. 

I have a file on a samba share, say
/mnt/remote/foo.
I read the file, modify its contents in my program and save a local copy, say 
/tmp/foo.
Then I try to copy the modified file back to its original place using
System.Directory.copyFile "/tmp/foo" "/mnt/remote/foo"

Sometimes the copyFile command produces an error like this:
/mnt/remote/.copyFile1804289383846930886.tmp: 
copyFile:atomicCopyFileContents:withReplacementFile:hClose: does not exist (Host is down)

When I copy /tmp/foo to /mnt/remote/foo using the shell, everything works fine. 
Does anyone have an idea what goes wrong? Internally withReplacementFile is used which indeed creates a temporary file to not risk corrupting the original. Is this maybe due to a wrong ordering of IO actions? 

Thanks
Olaf


More information about the Haskell-Cafe mailing list