The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Warner Losh <imp@bsdimp.com>
To: Clem Cole <clemc@ccc.com>
Cc: TUHS main list <tuhs@minnie.tuhs.org>
Subject: Re: [TUHS] moving directories in svr2
Date: Wed, 29 Dec 2021 09:33:24 -0700	[thread overview]
Message-ID: <CANCZdfrHF3Zdwy+cAvWf788+UimORMrO3TfLTXRXiU-G+21qKw@mail.gmail.com> (raw)
In-Reply-To: <CAC20D2OvJ2tyVPYMQFA5aLAWT9Ozn8o8aX78x0Wkf2PyH8eLjw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2804 bytes --]

Kirk has said it took decades to get rename(2) right... it was by far the
hardest system call to get right, especially in the face of concurrency.

Warner

Warner

On Wed, Dec 29, 2021, 9:11 AM Clem Cole <clemc@ccc.com> wrote:

> Just get the 4.1 man pages and it says: "Directories may only be moved
> within the same parent directory."
>
> On Wed, Dec 29, 2021 at 10:44 AM Will Senn <will.senn@gmail.com> wrote:
>
>> On 12/29/21 9:17 AM, Clem Cole wrote:
>>
>> Not until the BSD rename system call,.
>>
>> Try it on V6 or V7 and you will get 'directory exists' as an error.
>>
>> Sure enough. I never really noticed. I guess cuz I was careful about
>> creating directories in the first place.
>>
>> Think about the UNIX FS and the link system call. How is mv implemented?
>>   You link the file to the new directory and the unlink it from the old
>> one.   But a directory file can not be in two directories at the same time
>> as the .. link would fail.      When Joy created the rename system call it
>> became possible.  Until System V picked it up (IIRC was SVR3), only system
>> that supported the BSD world.
>>
>> Nice summary. I will add it to my systems programming investigations
>> list.
>>
>> What I have forgotten is if the BSD mv command for 4.1 supported it.  If
>> it did then it was not atomic -- it would have had to create the new
>> directory, move the contents independently and then remove the old one.
>>
>> FWIW: when we did the first SMP UNIX at Masscomp we had supported the BSD
>> FS and the 4.1c/4.2 system calls.   Joy's implementation of rename was a
>> real mess.   Making it atomic, supporting an SMP and deal with all the
>> recovery paths on an error took some work.  It's funny, the rename system
>> call is a simple idea, but on a failure when partially thru it, makes
>> unwinding the partial completion an interesting problem.
>>
>> It's impressive what early work was done and how few today really
>> understand the challenges that were met and overcome to give us our cushy
>> oses.
>>
>>
>> Clem
>>
>> On Wed, Dec 29, 2021 at 9:34 AM Will Senn <will.senn@gmail.com> wrote:
>>
>>> I'm a little flummoxed in trying to move some directories around in
>>> svr2. Shouldn't the following work?
>>>
>>>     mkdir a
>>>     mkdir b
>>>     mv a b
>>>
>>> I get the following error:
>>>     mv: b exists
>>>
>>> I tried many of the possible variants including:
>>>
>>> mv a b/
>>> mv: b/ exists
>>> mv a b/a
>>> mv: directory rename only
>>> cd b
>>> mv ../a .
>>> mv: . exists
>>> mv ../a ./
>>> mv: ./ exists
>>> mv ../a ./a
>>> mv: directory rename only
>>>
>>>
>>> If moving directories into existing directories wasn't allowed in those
>>> days, 1) how were directories managed? and 2) when did moving directories
>>> into directories become a thing?
>>>
>>>
>>>
>>

[-- Attachment #2: Type: text/html, Size: 6377 bytes --]

  reply	other threads:[~2021-12-29 16:34 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-29 14:33 Will Senn
2021-12-29 15:02 ` arnold
2021-12-29 15:38   ` Will Senn
2021-12-29 15:44     ` Richard Salz
2021-12-29 16:17       ` Clem Cole
2021-12-29 16:58         ` Richard Salz
2021-12-30  5:14         ` Dan Stromberg
2021-12-30 16:22           ` Clem Cole
2021-12-30 18:02           ` John Cowan
2021-12-30 23:04             ` Richard Salz
2021-12-29 15:17 ` Clem Cole
2021-12-29 15:44   ` Will Senn
2021-12-29 16:10     ` Clem Cole
2021-12-29 16:33       ` Warner Losh [this message]
2021-12-29 16:01   ` Bakul Shah
2021-12-29 16:59 Bakul Shah
2021-12-29 17:04 ` Clem Cole
2021-12-29 17:14 ` arnold
2021-12-29 17:38   ` Clem Cole
2021-12-29 17:49     ` Brantley Coile
2021-12-29 18:27       ` ron minnich
2021-12-29 20:59         ` Rob Pike
2021-12-29 17:12 Douglas McIlroy
2021-12-29 19:13 Douglas McIlroy
2021-12-29 19:37 ` Dan Cross
2021-12-29 20:15   ` Dan Cross
2021-12-29 20:42     ` Richard Salz
2021-12-29 20:58       ` Dan Cross
2021-12-29 21:20         ` Clem Cole
2021-12-30  3:15       ` Bakul Shah
2021-12-29 19:33 Noel Chiappa
2021-12-30  3:40 ` Jay Logue via TUHS
2021-12-30  3:45 Noel Chiappa
2021-12-30  4:02 ` Bakul Shah
2021-12-30 16:40 ` Theodore Ts'o
2021-12-30 22:31   ` Dan Cross
2021-12-31  0:43     ` Bakul Shah
2021-12-31  1:00       ` Rob Pike
2021-12-31  1:45         ` Bakul Shah
2021-12-31  2:23           ` Adam Thornton
2021-12-31 18:56       ` Chet Ramey
2021-12-31  3:08     ` Theodore Ts'o
2021-12-31  3:23       ` Rob Pike
2021-12-31  5:16         ` Theodore Ts'o
2021-12-31  5:21           ` Dan Cross
2021-12-31  5:55           ` Rob Pike
2021-12-31 13:32             ` Michael Kjörling
2021-12-31 15:53               ` Adam Thornton
2021-12-31 16:13                 ` Arthur Krewat
2021-12-31 18:17                 ` Dan Cross
2021-12-31 18:23                   ` Larry McVoy
2021-12-31 18:37                     ` Dan Cross
2021-12-31 18:29                   ` Arthur Krewat
2022-01-01  0:09                   ` Theodore Ts'o
2022-01-03 13:35                     ` Dan Cross
2022-01-03 20:23                       ` Theodore Ts'o
2022-01-03 20:45                         ` Warner Losh
2022-01-03 21:15                         ` Dan Cross
2022-01-03 22:26                           ` Theodore Ts'o
2022-01-03 23:10                             ` Dan Cross
2022-01-04 15:45                             ` Chet Ramey
2022-01-09 19:28                             ` Larry McVoy
2022-01-03 23:21                           ` Doug McIntyre
2022-01-03 23:37                             ` Adam Thornton
2022-01-04 14:49                               ` Stuart Remphrey
2022-01-03 23:44                             ` Larry McVoy
2022-01-03 23:56                               ` Warner Losh
2022-01-04  2:28                               ` Theodore Ts'o
2022-01-04  2:42                                 ` Larry McVoy
2022-01-03 22:57                         ` Phil Budne
2021-12-31  5:12       ` Bakul Shah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANCZdfrHF3Zdwy+cAvWf788+UimORMrO3TfLTXRXiU-G+21qKw@mail.gmail.com \
    --to=imp@bsdimp.com \
    --cc=clemc@ccc.com \
    --cc=tuhs@minnie.tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).