The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* Re: [TUHS] moving directories in svr2
@ 2021-12-30  3:45 Noel Chiappa
  2021-12-30  4:02 ` Bakul Shah
  2021-12-30 16:40 ` Theodore Ts'o
  0 siblings, 2 replies; 81+ messages in thread
From: Noel Chiappa @ 2021-12-30  3:45 UTC (permalink / raw)
  To: tuhs; +Cc: jnc

    > From: Bakul Shah

    > My guess is *not* storing a path instead of a ptr to the inode was done
    > to save on memory.

More probably speed; those old disks were not fast, and on a PDP-11, disk
caches were so small that converting the path to the current directory to its
in memory inode could take a bunch of disk reads.

    > Every inode has a linkcount so detecting when the last conn. is severed
    > not a problem.

Depends; if a directory _has_ to be empty before it can be deleted, maybe; but
if not, no. (Consider if /a/b/c/d exists, and /a/b is removed; the tree
underneath it has to be walked and the components deleted. That could take a
while...) In the general case (e.g. without the restriction to a tree), it's
basically the same problem as garbage collection in LISP.

	  Noel

^ permalink raw reply	[flat|nested] 81+ messages in thread
* Re: [TUHS] moving directories in svr2
@ 2021-12-29 19:33 Noel Chiappa
  2021-12-30  3:40 ` Jay Logue via TUHS
  0 siblings, 1 reply; 81+ messages in thread
From: Noel Chiappa @ 2021-12-29 19:33 UTC (permalink / raw)
  To: tuhs; +Cc: jnc

    > From: Clem Cole

    > Try it on V6 or V7 and you will get 'directory exists' as an error.

The V6 'mv' is prepared to move a directory _within_ a directory (i.e.
'rename' functionality). I'm not sure why it's not prepared to move within
a partition; probably whoever wrote it wasn't prepared to deal with all the
extra work for that (unlink from the old '..', then link to the '..' in the
new directory, etc, etc).

(The MIT PWB1 had a 'mvdir' written by Jeff Schiller, so PWB1 didn't have
'move directory' functionality before that. MIT must have been using the PWB1
system for 6.031, which I didn't recall; the comments in 'mvdir' refer to it
being used there.)

The V6 'mv' is fairly complicated (as I found out when I tried to modify it
to use 'smdate()', so that moving a file didn't change its 'last write'
date). Oddly enough, it is prepared to do cross-partition 'moves' (it forks a
'cp' to do the move). Although on V6, 'cp' only does one file; 'cp *.c
{dest}' was not supported, there was 'cpall' for that. (Why no 'mvall', I
wonder? It would have been trivial to clone 'cpall'.)

Run fact; the V6 'mv' is the place that has the famous (?)  "values of B will
 give rise to dom!" error message (in the directory-moing section).

    > 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.

Speaking of atomic operation, in V6 'mkdir' (not being a system call) was
not atomic, so if interrupted at 'just the right time', it could leave
the FS in an inconsistent state. That's the best reason I've come across
to make 'mkdir' a system call - it can be made atomic that way.

	Noel

^ permalink raw reply	[flat|nested] 81+ messages in thread
* Re: [TUHS] moving directories in svr2
@ 2021-12-29 19:13 Douglas McIlroy
  2021-12-29 19:37 ` Dan Cross
  0 siblings, 1 reply; 81+ messages in thread
From: Douglas McIlroy @ 2021-12-29 19:13 UTC (permalink / raw)
  To: TUHS main list

> what was the last Unix version
> that let users make arbitrary links, such that the file system was no
> longer a DAG? I recall in v6 days hearing that earlier Unix allowed
> this, and that cleanup (via icheck and friends) got to be near
> impossible.

From v1 on (I'm not sure about PDP-7 Unix) only the superuser could do
that, so what you heard strikes me as urban legend. Perhaps some
installations abused root privilege to scramble the file system, but I
certainly didn't see that happen in Research systems.

Doug

^ permalink raw reply	[flat|nested] 81+ messages in thread
* Re: [TUHS] moving directories in svr2
@ 2021-12-29 17:12 Douglas McIlroy
  0 siblings, 0 replies; 81+ messages in thread
From: Douglas McIlroy @ 2021-12-29 17:12 UTC (permalink / raw)
  To: TUHS main list

The first specific mention of moving directories in Research is in
v10, but I'm sure that was implemented considerably earlier. The only
things special about moving a directory were that it needed root
privilege and checked against moving a directory into itself. As with
ordinary files, copying (with loss of hard links) happened only when
moving between different file systems. As far as I know, no atomicity
precautions were taken.

^ permalink raw reply	[flat|nested] 81+ messages in thread
* Re: [TUHS] moving directories in svr2
@ 2021-12-29 16:59 Bakul Shah
  2021-12-29 17:04 ` Clem Cole
  2021-12-29 17:14 ` arnold
  0 siblings, 2 replies; 81+ messages in thread
From: Bakul Shah @ 2021-12-29 16:59 UTC (permalink / raw)
  To: Clem Cole; +Cc: TUHS main list


On Dec 29, 2021, at 8:01 AM, Bakul Shah <bakul@iitbombay.org> wrote:
> On Dec 29, 2021, at 7:18 AM, Clem Cole <clemc@ccc.com> wrote:
>> 
>> 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.
> 
> Don’t see why linking a dir in two places is a problem.

To expand on this a bit, the “cd ..” case can be handled by not storing a ..
link in a dir. in the first place! Store the $PWD path in the u struct. Then
cd .. would simply lop off the last component, if one exists. Thus .. takes
you back only on the path you used! This also takes care of the issue with
symlinks (& does what csh did in user code).

^ permalink raw reply	[flat|nested] 81+ messages in thread
* [TUHS] moving directories in svr2
@ 2021-12-29 14:33 Will Senn
  2021-12-29 15:02 ` arnold
  2021-12-29 15:17 ` Clem Cole
  0 siblings, 2 replies; 81+ messages in thread
From: Will Senn @ 2021-12-29 14:33 UTC (permalink / raw)
  To: TUHS main list

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

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: 1270 bytes --]

^ permalink raw reply	[flat|nested] 81+ messages in thread

end of thread, other threads:[~2022-01-13  2:35 UTC | newest]

Thread overview: 81+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-30  3:45 [TUHS] moving directories in svr2 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                               ` [TUHS] SMP: BSD vs System V (once was: moving directories in svr2) Greg 'groggy' Lehey
2022-01-07 19:01                                 ` Warner Losh
2022-01-09 17:31                                 ` Stuart Remphrey
2022-01-13  2:35                                 ` Kevin Bowling
2022-01-03 23:56                               ` [TUHS] moving directories in svr2 Warner Losh
2022-01-04  2:28                               ` Theodore Ts'o
2022-01-04  2:42                                 ` Larry McVoy
2022-01-04  9:28                                 ` [TUHS] Mythical Distress Sale (was Re: moving directories in svr2) Rob Gingell
2022-01-04 15:17                                   ` Larry McVoy
2022-01-04 15:26                                     ` arnold
2022-01-04 15:40                                       ` Larry McVoy
2022-01-04 15:48                                         ` Richard Salz
2022-01-03 22:57                         ` [TUHS] moving directories in svr2 Phil Budne
2022-01-04 15:40                         ` [TUHS] VRFs (was Re: moving directories in svr2) Derek Fawcus
2021-12-31  5:12       ` [TUHS] moving directories in svr2 Bakul Shah
  -- strict thread matches above, loose matches on Subject: below --
2021-12-29 19:33 Noel Chiappa
2021-12-30  3:40 ` Jay Logue via TUHS
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 17:12 Douglas McIlroy
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 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
2021-12-29 16:01   ` Bakul Shah

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).