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?
Are there any extant 2.11 manuals other than the online manual and various install and configure PDFs, available for download?
Also, am I understanding correctly that 2.11 is 2.10 plus some 4.3 backports and a ton of patches? If there aren’t any 2.11 specific docs, what would be the closest of what is available?
Will
Sent from my iPhone
> 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
> 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
On Dec 29, 2021, at 8:01 AM, Bakul Shah <bakul(a)iitbombay.org> wrote:
> On Dec 29, 2021, at 7:18 AM, Clem Cole <clemc(a)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).
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.
The core system of svr2 distributed by ATT for the 3b2-400 doesn't come
with manpages installed. Does anybody know of a set of manpages for SVR2
that can be installed into the system? It's not the end of the world, if
not... the user guide is available as a pdf, but it'd be handy to have
man on the system.
Will
Is it possible to use echo to send a vt-100 escape sequence in v6/v7/sysvr2?
I can write a c program to clear the screen and go home in sysvr2:
#define ASCII_ESC 27
main()
{
printf( "%c[2J", ASCII_ESC );
printf( "%c[H", ASCII_ESC );
}
and it works fine. I can type the escape sequences in as well, but I'd
just as soon write a shell script with an echo '[[2J;[[H' or something
similar without having to compile a clear command. Is it possible and
what do I need to know :)?.
Thanks,
Will
> From: Will Senn
> anything similar to modern behavior when handling the delete/backspace
> key where the character is deleted from the input and rubbed out? The
> default, like in v6/v7 for erase and kill is # and @. I can live with
> this, if I can't get it to do the rubout, because at least you can see
> the # in the input
I use ASCII 'backspace' (^H) on my V6, and it 'sort of' works; it doesn't
erase the deleted character on the screen, but if one then types corrected
characters, they overlay the deleted ones, leaving the corrected input. That
should work on everything later than V6.
The MIT PWB1 tty handler (link in a prior message) not only supported a 'kill
line' (we generally used '^U') which actually visibly deleted the old line
contents (on screen terminals, of course; on printing terminals you're
stuck), it also had suppport for '^R' (re-type line) and some other stuff.
Noel
Did svr2 have anything similar to modern behavior when handling the
delete/backspace key where the character is deleted from the input and
rubbed out? The default, like in v6/v7 for erase and kill is # and @. I
can live with this, if I can't get it to do the rubout, because at least
you can see the # in the input, but if I can figure out how to get it to
rubout the last character, I'd map erase to DEL, which I believe to be
^U (but since it's invisible, it's confusing when it doesn't rubout).
Will