[erlang-bugs] Copying a file to itself

Bengt Kleberg <>
Fri Feb 29 10:46:09 CET 2008


Greetings,

This old unix warning might be a source of inspiration for the
documentation:

     BUGS
          Beware of `cat a b >a' and `cat a b >b', which destroy input
          files before reading them.


bengt

On Fri, 2008-02-29 at 10:31 +0100, John Hughes wrote:
> 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.
> 
>  
> 
> John Hughes
> 
> 
> _______________________________________________
> erlang-bugs mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-bugs




More information about the erlang-bugs mailing list