[erlang-questions] Problem in file:rawopen/2

Bjorn Gustavsson bjorn@REDACTED
Mon Feb 25 12:18:19 CET 2008

Matthias Lang <matthias@REDACTED> writes:

> Taking a few steps back at this problem, Sumith is trying to copy a
> directory by opening it as a file and copying the contents. This is a
> trick, i.e. it exploits knowledge about how directories are
> implemented in some operating systems. He's then combining that first
> trick with a second trick, namely using an undocumented function. That
> has "will probably blow up in your face" written all over it.

I don't think he actually opens the directory itself. That is supposed
to give an {error,eisdir} on any platform. (Erlang has never allowed
reading directories as files, even on Unix systems.)

> A warning wouldn't hurt, though compiler-administered electric 
> shocks would be more effective.

Good idea. :-)

Björn Gustavsson, Erlang/OTP, Ericsson AB

More information about the erlang-questions mailing list