Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Sep 1996 17:02:31 +0930 (CST)
From:      Michael Smith <msmith@atrad.adelaide.edu.au>
To:        emulation@freebsd.org
Subject:   DOScmd redirector hair-tearing time
Message-ID:  <199609230732.RAA24335@genesis.atrad.adelaide.edu.au>

next in thread | raw e-mail | index | archive | help

Argh!

Thanks to a bug report from Robert Eckardt, I've been following the 
behaviour of the DOScmd redirector during 'file copy' operations.

The following session comes from :

doscmd -bxR
<boots>
d:
cd tmp
copy rc baz
	0 file(s) copied

And the debugging output from the copy operation looks like this 
(edited and annotated) :


dos_getcwd(3) -> \TMP
D:\TMP\RC -> drive D func 2e (us)
REDIR: 2e (extended open/create)
dos_makepath(3, \TMP\RC)
dos_to_real_path(D:\TMP\RC)
mopen(//tmp/rc) action 0x101  mode 0x0  attr 0x0 omode 0x40 
success, fd 5  status 1
REDIR: returns 0 (OK)
dos_getcwd(3) -> \TMP
(no path) -> drive D func 6 (us)
REDIR: 06 (close)
close(5)
REDIR: returns 0 (OK)

Open the source, file, then close it again.  Weird.

dos_getcwd(3) -> \TMP
D:\TMP\RC -> drive D func 1b (us)
REDIR: 1b (find first)
find_first(D:\TMP\RC, 0, 159e)
dos_makepath(3, \TMP\RC)
dos_to_real_path(D:\TMP)
REDIR: returns 0 (OK)

Then search for the file.

dos_getcwd(3) -> \TMP
D:\TMP\BAZ -> drive D func 2e (us)
REDIR: 2e (extended open/create)
dos_makepath(3, \TMP\BAZ)
dos_to_real_path(D:\TMP\BAZ)
mopen(//tmp/baz) action 0x101  mode 0x0  attr 0x0 omode 0x40 
REDIR: returns 2 (FILE_NOT_FOUND)

Try to open the destination, fail if not found.  Which it's not.

dos_getcwd(3) -> \TMP
D:\TMP\BAZ -> drive D func 5 (us)
REDIR: 05 (chdir)
dos_makepath(3, \TMP\BAZ)
dos_to_real_path(D:\TMP\BAZ)
dos_readonly(3) -> 0
chdir(//tmp/baz)
dos_setcwd(D:\TMP\BAZ)
dos_makepath(3, \TMP\BAZ)
dos_to_real_path(D:\TMP\BAZ)
REDIR: returns 3 (PATH_NOT_FOUND)

Try to chdir to the destination.  Weird.

dos_getcwd(3) -> \TMP
D:\TMP -> drive D func 5 (us)
REDIR: 05 (chdir)
dos_makepath(3, \TMP)
dos_to_real_path(D:\TMP)
dos_readonly(3) -> 0
chdir(//tmp)
dos_setcwd(D:\TMP)
dos_makepath(3, \TMP)
dos_to_real_path(D:\TMP)
REDIR: returns 0 (OK)

Chdir back.  Also Weird.

dos_getcwd(3) -> \TMP
D:\TMP\BAZ -> drive D func f (us)
REDIR: 0f (stat)
dos_makepath(3, \TMP\BAZ)
dos_to_real_path(D:\TMP\BAZ)
REDIR: returns 2 (FILE_NOT_FOUND)

Try to stat the destination.  Which doesn't exist.

dos_getcwd(3) -> \TMP
D:\TMP\RC -> drive D func 2e (us)
REDIR: 2e (extended open/create)
dos_makepath(3, \TMP\RC)
dos_to_real_path(D:\TMP\RC)
mopen(//tmp/rc) action 0x101  mode 0x0  attr 0x0 omode 0x40 
success, fd 5  status 1
REDIR: returns 0 (OK)
dos_getcwd(3) -> \TMP
(no path) -> drive D func 8 (us)
REDIR: 08 (read)
read(5, 65024)
offset now 7634
REDIR: returns 0 (OK)
dos_getcwd(3) -> \TMP
(no path) -> drive D func 6 (us)
REDIR: 06 (close)
close(5)
REDIR: returns 0 (OK)

Open, read and close the source.  All OK.

dos_getcwd(3) -> \TMP
D:\TMP\BAZ -> drive D func 2e (us)
REDIR: 2e (extended open/create)
dos_makepath(3, \TMP\BAZ)
dos_to_real_path(D:\TMP\BAZ)
mopen(//tmp/baz) action 0x112  mode 0x401  attr 0x0 omode 0x21 
success, fd 5  status 2
REDIR: returns 0 (OK)
dos_getcwd(3) -> \TMP
(no path) -> drive D func 9 (us)
REDIR: 09 (write)
write(5, 7634)
offset now 7634
REDIR: returns 0 (OK)
dos_getcwd(3) -> \TMP
(no path) -> drive D func 6 (us)
REDIR: 06 (close)
close(5)
REDIR: returns 0 (OK)

Open, write and close the destination.  All OK.

dos_getcwd(3) -> \TMP
D:\TMP\BAZ -> drive D func 13 (us)
REDIR: 13 (unlink)
dos_makepath(3, \TMP\BAZ)
dos_to_real_path(D:\TMP\BAZ)
dos_readonly(3) -> 0
unlink(//tmp/baz)
REDIR: returns 0 (OK)

And then delete the destination?! What the hell?

If I disable the 'unlink' call, then the file can be seen to have been
correctly copied, but that doesn't explain what DOS is so unhappy about
that it'd delete the destination.  None of the redirector calls have
returned anything other than OK (other than the 'qualify' calls which 
I pruned for brevity).

Any ideas?

-- 
]] Mike Smith, Software Engineer        msmith@atrad.adelaide.edu.au    [[
]] Genesis Software                     genesis@atrad.adelaide.edu.au   [[
]] High-speed data acquisition and      (GSM mobile) 0411-222-496       [[
]] realtime instrument control          (ph/fax)  +61-8-267-3039        [[
]] Collector of old Unix hardware.      "Where are your PEZ?" The Tick  [[



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609230732.RAA24335>