From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HTML_MESSAGE,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2055 invoked from network); 29 Dec 2021 16:34:12 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 29 Dec 2021 16:34:12 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id CF4029CEF3; Thu, 30 Dec 2021 02:34:10 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 7F81E9CED2; Thu, 30 Dec 2021 02:33:38 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.b="ehcAWdrt"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 836839CED2; Thu, 30 Dec 2021 02:33:36 +1000 (AEST) Received: from mail-vk1-f175.google.com (mail-vk1-f175.google.com [209.85.221.175]) by minnie.tuhs.org (Postfix) with ESMTPS id 5CAFD9CEA9 for ; Thu, 30 Dec 2021 02:33:35 +1000 (AEST) Received: by mail-vk1-f175.google.com with SMTP id j4so9563836vkr.12 for ; Wed, 29 Dec 2021 08:33:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bLHuJp2SU4F3DzdskdxTFKp4rehzqEClzh2mGcqHoZ8=; b=ehcAWdrtbeuSJ99ZwXMTx2WBiUXUUB7Bmgrt+APAdpZB2YYdDu2tXxBG6xUiVYY8sV gj/3+U1FLvqDdejJmHUXd936RIH0wkRbBvlZbjHdYEk0g7XOKX/vV+1JYAni1+QEkczR qVnaQb6vuEb1HZidaYTgq4JzGa9aLZprp3mi3GBaqLXREA5cEghjcC9Gb/NPnMbZXySu rjRhF36ACzhNQgS7v0L4mKoB7TEHHGmg5osf2pTyfqM5/GbuN8vTUWLhUeEeLhNTNqGd 7KNECIyBbGaIlammUtcDZFOe5EdwmFJAN7mNo3lGCh3MJCOMWoxLQmK1xa0T+G0mM/Jx NDoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bLHuJp2SU4F3DzdskdxTFKp4rehzqEClzh2mGcqHoZ8=; b=7lbXO6dXaYq6HBqHtdQdILUYT5f+FNrfT+UME7EfOGsVvUqR9WCxT2+m8tpfBAWA/H rmNPBI/W9TK4Va2VJ/4WLT/1miAvSiA7ZT6/3EOKb3V+0Bl3VB49rDjEUZM+1rMf5nxz rzRUBvEpX6gmsRYQO157dEzSW8QCE4RB8ffz1bMsI6vUUjlDn8uaL1h2AKd4lmZ9TPte rvdrB3odRrUetwybdtcCgxOub0jqqzlA9KWP11sKzGZI2bh1xr9TgBPslK45U9hf27or cxMJyl7B7j3MECuKU8qrfgBaP1w4m3DsrMeOQulJWL6YiAOgj1DcrwKp3kpeqAfOosKx uKYA== X-Gm-Message-State: AOAM533yLMUt92fOjcMq+nb3M6V88H9gbO/zW1xYXfCs7vsfwAtT+j8V 6q5jB9IENuLgkSZyncp8ugIlVzE4gu+svKMPAwSE/w== X-Google-Smtp-Source: ABdhPJy64WymVOkemjob7U762Mzob7BTLDZyRZPLCkD89i5sUgcErY8JqkNdMiU3fgRD4fUqQqrndKQrDUvm+ViEVQ4= X-Received: by 2002:a1f:ae91:: with SMTP id x139mr8940251vke.2.1640795614045; Wed, 29 Dec 2021 08:33:34 -0800 (PST) MIME-Version: 1.0 References: <529fceae-2493-e9b1-c949-928e95e430e1@gmail.com> In-Reply-To: From: Warner Losh Date: Wed, 29 Dec 2021 09:33:24 -0700 Message-ID: To: Clem Cole Content-Type: multipart/alternative; boundary="000000000000b9794a05d44b7fc4" Subject: Re: [TUHS] moving directories in svr2 X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: TUHS main list Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --000000000000b9794a05d44b7fc4 Content-Type: text/plain; charset="UTF-8" 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 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 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 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? >>> >>> >>> >> --000000000000b9794a05d44b7fc4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 f= ace of concurrency.

Warn= er

Warner

On W= ed, Dec 29, 2021, 9:11 AM Clem Cole <cl= emc@ccc.com> wrote:
Just get the 4.1 man pages and it says: "Directories may o= nly be moved within the same parent directory."

On Wed, Dec 29, 2= 021 at 10:44 AM Will Senn <will.senn@gmail.com> wrote:
=
=20 =20 =20
On 12/29/21 9:17 AM, Clem Cole wrote:
=20
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? =C2=A0 Y= ou link the file to the new directory and the unlink it from=C2=A0th= e old one. =C2=A0 But a directory file can not be in two directorie= s at the same time as the .. link would fail. =C2=A0 =C2=A0 =C2=A0W= hen Joy created the rename system call it became possible.=C2=A0 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.=C2=A0 If it did then it was not atomic -- it would have had to create the new directory, move the contents independently=C2=A0and 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. =C2=A0 Joy's implementation of rename was a real mess. =C2=A0 Making it atomic, supporting an SM= P and deal with all the recovery paths on an error took some work.=C2=A0 It's funny, the rename system call is a simple id= ea, but on a failure when partially=C2=A0thru 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 littl= e flummoxed in trying to move some directories around in svr2. Shouldn't the following work?

=C2=A0=C2=A0=C2=A0 mkdir a
=C2=A0=C2=A0=C2=A0 mkdir b
=C2=A0=C2=A0=C2=A0 mv a b

I get the following error:
=C2=A0=C2=A0=C2=A0 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?



--000000000000b9794a05d44b7fc4--