Mailinglist Archive: opensuse (626 mails)

< Previous Next >
[opensuse] Re: 'mv' a read-only directory doesn't work...why not?
On 11/9/2018 11:10 AM, Aaron Digulla wrote:

To "emphasize the point": 1) I can do a 'cp -a a/dir1 b/' which
works. Since they are
on the same device, even hardlinks will be duplicated.
2) I can then follow-up with 'rmdir a/dir1', which also
works (no warning like when removing a file):
> rm a/file1
rm: remove write-protected regular empty file 'a/file1'?

I.e. the exact same actions 'mv' would do if I was copying
between devices.

Err no. The actions have the same result but use different operations.
To get to the backside of a house, I can go left and right (and even
over the roof). Same result, different ways.
Except the copy+delete is exactly what 'mv' does
when the target is on a different file system.

I.e. it could transparently do the same operations when the user asks for a 'mv'. wouldn't be as efficient, but it would mv the read-only directory. Just can't move it directly.
To me, that seems a bit if you make the dir
read-only, then you have to use the inefficient form to move it,
vs. moving it directly.

But if I can't update the '..' entry, that would imply
I couldn't rename the parent -- but I can. So why can I update
'..' if I rename the parent, but not by moving the child?
It seems not only a bit arbitrary, but also pointless, though
you do have the "benefit"(?) of losing the original owners and time
and date stamps of the directories and files below the top.

There's also the fact that I can goto another platform
cygwin on win, and rename the directory w/no problem:
/tmp> mkdir a
/tmp> mkdir a/dir1
/tmp> mkdir b
/tmp> mv a/dir1 b/
Why, on linux can I rmdir a/dir1, with no problem/warning (where
'dir1' is a read-only dir)? I'd think deleting should generate some
permission denied message if only moving it generates one, no?

Thanks for response...I guess I'm unhappy with the inconsistencies and


To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups