Why, for example, maps but array?

Richard O'Keefe raoknz@REDACTED
Mon Aug 16 03:38:02 CEST 2021

There is also the question of the semantics of "moving" a file.
If I open X for reading, Y for writing, copy contents of X to Y,
close both, and delete X, have I "moved" X?

In a file system with attributes (BeOS, NTFS, macOS, Linux),
the answer is NO, I have moved the *contents* of the file, but
the *attributes* have been lost.

In Linux at least, it isn't *possible* for a process without certain
capabilities to copy *all* the attributes of a file.

Copying a file from one file system to another may run into problems.
For example, some Linux file systems impose no limit on the total size
of attributes, but others require them to all fit in a single block.

Let's not get into the issues of copying between file systems with
*different* attribute systems, difference attribute namespaces &c.

Did I mention access control lists (ACLs)?  I set out to provide an
interface to ACLs once, only to discover that the operating systems
I wanted this to work on had very very little in common.  What does
it mean to "move" a file to a file system from another machine with
a different set of users?

Honestly, the deeper I look into *any* operating system issue the
more I dread woodpeckers [%].

[%] "If builders built buildings the way programmers write programs,
      the first woodpecker that came along would destroy civilization."
     -- Weinberg's second law.

On Mon, 16 Aug 2021 at 02:30, Lloyd R. Prentice <lloyd@REDACTED> wrote:
> Ah, thank you, Łukasz,
> Got it.
> All the best,
> Sent from my iPad
> > On Aug 15, 2021, at 5:21 AM, Łukasz Niemier <lukasz@REDACTED> wrote:
> >
> > 
> >>
> >> But it surprises me that obvious functions like file:move/2
> >
> > The problem is that such function is far from "obvious". If you look through many languages you will see, that rarely there is `move` function that moves the file from one location to another. Reason for that is simple - UNIX (I do not know how about Windows) do not have such function, instead there is `rename` function which indeed is present in Erlang [1]. That function has one great limitation - it works **only within single filesystem**. If you want to move file between different filesystems, then it will fail.
> >
> > - But, there is `mv` command in shell.
> >
> > You may ask. Yes, there is such command, but it operates in 2 different ways, depending on the locations of the files:
> >
> > - If source and destination is on the same filesystem, then it just call `rename` and call it a day.
> > - If source and destination is on different filesystems, then it reads source file, writes it in the destination (aka, does a copy of that file) and then removes the source.
> >
> > So reasons for non-existence of `file:move/2` in Erlang is law of leaky abstractions. Nothing more, nothing less.
> >
> > [1]: https://erlang.org/doc/man/file.html#rename-2
> >
> > --
> >
> > Łukasz Niemier
> > lukasz@REDACTED
> >

More information about the erlang-questions mailing list