[erlang-bugs] Copying a file to itself

Ulf Wiger (TN/EAB) <>
Fri Feb 29 10:37:57 CET 2008

John Hughes skrev:
> Calling file:copy(Name,Name) to copy a file to itself truncates the file 
> to 0 bytes. I’m not sure if this is a bug, but it isn’t what I 
> expected—even after reading the documentation. Perhaps either file:copy 
> should return an error in this case, or the documentation should mention 
> this behaviour explicitly.


You need to stop using QuickCheck on well tested libraries! ;-)

Let us keep *some* of our illusions of quality software.

Seriously, I'd be happy if file:copy(Name,Name) works just like in Unix, 
i.e. it doesn't do anything, since the files are identical.

$> cp Makefile test
$> ls -l test
-r--r--r--   1 ....       2676 Feb 29 10:35 test
$> cp test test
cp: test and test are identical
$> ls -l test
-r--r--r--   1 ....       2676 Feb 29 10:35 test

Ulf W

More information about the erlang-bugs mailing list