From: Greg Ercolano <erco@(email surpressed)>
Subject: [WINDOWS/ADMIN] Windows Vista: real symbolic links..?
   Date: Wed, 30 May 2007 01:27:37 -0400
Msg# 1553
View Complete Thread (6 articles) | All Threads
Last Next
Hmm, quite possibly an actual reason to buy Vista:

	C:\> mklink /d \jobs \\tahoe\jobs
	C:\> dir \jobs
	[..directory listing of \\tahoe\jobs comes up..]

Be administrator to do that.

This worked on my 'Business Edition" version of Vista.

When I recover from shock, I'll do some more tests within Rush.

   From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: [WINDOWS/ADMIN] Windows Vista: real symbolic links..?
   Date: Wed, 30 May 2007 01:58:08 -0400
Msg# 1554
View Complete Thread (6 articles) | All Threads
Last Next
Greg Ercolano wrote:
> When I recover from shock, I'll do some more tests within Rush.

	Wow, yeah, Vista's symlinks to UNC network drives works
	inside Rush too.

	This is pretty cool.. it means you can finally use regular
	pathnames to your file server, without the double leading slash,
	and without being locked to hostnames in paths.

	It also means that if a server dies, you can change the symlinks
	to point to a different server, just like unix.

	Pardon me while I have a heart attack.

	And holy crap, in DOS you can even 'CD' to the symlink, and
	end up with your server as the 'current directory'. In the past,
	this was impossible (*); DOS wouldn't let you CD to a UNC path, it
	had to be a drive map. But DOS has no trouble following a symlink
	to a UNC path. So this kinda obsoletes drive letters, and all that
	weird baggage they imply.

	BTW, in a directory listing, the symlink shows up displayed
	in a reasonable manner as well:

C:\>dir c:\ | findstr jobs
05/29/2007  10:07 PM    <SYMLINKD>     jobs [\\tahoe\jobs]
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

	Be sure to use RMDIR to remove a symlink created with MKLINK /D.
	Do NOT use 'DEL'.. it tries to *follow* the symlink, and delete
	the files on the server. This behavior is unlike rm(1) in unix.

	So symlinks in Windows.. apparently hell has frozen over.

	I need a drink.


(*) There's actually a registry tweak that allows a UNC path to be
    the current working directory in DOS:
    http://support.microsoft.com/kb/156276

    Allow UNC paths at command prompt
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor]
    "DisableUNCCheck"=dword:00000001


   From: Luke Cole <luke@(email surpressed).au>
Subject: Re: [WINDOWS/ADMIN] Windows Vista: real symbolic links..?
   Date: Wed, 30 May 2007 02:18:14 -0400
Msg# 1555
View Complete Thread (6 articles) | All Threads
Last Next
Hi Greg,

	BTW, use RMDIR to remote a symlink created with MKLINK /D.
	Do NOT use 'DEL'.. it tries to *follow* the symlink, and delete
	the files on the server. This is unlike rm(1) in unix.

I can't help but wonder - what happens if you end up with a situation like this?:

Directory called "abc" with a symlink inside to directory "def" with a symlink inside to directory "abc".

Does rmdir loop forever?

Thanks,

---
Luke Cole
Research & Development

FUEL International
65 King St., Newtown, Sydney NSW, Australia 2042



   From: Luke Cole <luke@(email surpressed).au>
Subject: Re: [WINDOWS/ADMIN] Windows Vista: real symbolic links..?
   Date: Wed, 30 May 2007 02:20:22 -0400
Msg# 1556
View Complete Thread (6 articles) | All Threads
Last Next
Umm...actually I really meant to ask "Does *del* loop forever?"

On 30/05/2007, at 4:18 PM, Luke Cole wrote:

[posted to rush.general]

Hi Greg,

	BTW, use RMDIR to remote a symlink created with MKLINK /D.
	Do NOT use 'DEL'.. it tries to *follow* the symlink, and delete
	the files on the server. This is unlike rm(1) in unix.

I can't help but wonder - what happens if you end up with a situation like this?:

Directory called "abc" with a symlink inside to directory "def" with a symlink inside to directory "abc".

Does rmdir loop forever?

Thanks,

---
Luke Cole
Research & Development

FUEL International
65 King St., Newtown, Sydney NSW, Australia 2042



   From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: [WINDOWS/ADMIN] Windows Vista: real symbolic links..?
   Date: Wed, 30 May 2007 13:37:42 -0400
Msg# 1557
View Complete Thread (6 articles) | All Threads
Last Next
Luke Cole wrote:
>> I can't help but wonder - what happens if you end up with a  
>> situation like this?:
>>
>> Directory called "abc" with a symlink inside to directory "def"  
>> with a symlink inside to directory "abc".
>>
>> Does [del] loop forever?

	Good question.. you mean "del /s", right?

	No, in all the tests I tried (below) making circular 'directory'
	links (mklink /d), it behaves well with both 'del /s' and 'rmdir /s'
	it would seem.

	The only command I was able to get to loop forever was 'dir /s'.

	My approach was:

mkdir \temp\test
cd \temp\test
mkdir bar
echo foo > bar\aaa
echo foo > bar\bbb
mkdir bar\subdir
echo foo > bar\subdir\ccc
echo foo > bar\subdir\ddd        _
mklink /d tobar \temp\test\bar    |___ create circular links
mklink /d bar\totest \temp\test  _|

	..and then manipulating the 'tobar' link with the following commands.

DEL /S
------
	In the case of 'del /s somelink', it just deletes the files
	it finds in each directory recursively, then stops. No dirs
	or links removed.

	My guess is it prevents looping forever by keeping track of
	the actual directories its been into, converting each link 
	it encounters as it goes into actual dir names, and /not/ 
	descending into any link to a dir its already been to. Proof:

            C:\TEMP\test>del /s tobar
            C:\TEMP\test\tobar\*, Are you sure (Y/N)? y
            Deleted file - C:\TEMP\test\tobar\aaa
            Deleted file - C:\TEMP\test\tobar\bbb
            C:\TEMP\test\tobar\subdir\*, Are you sure (Y/N)? y
            Deleted file - C:\TEMP\test\tobar\subdir\ccc
            Deleted file - C:\TEMP\test\tobar\subdir\ddd

            C:\TEMP\test>dir
            [..]
             Directory of C:\TEMP\test

            05/30/2007  10:26 AM    <DIR>          .
            05/30/2007  10:26 AM    <DIR>          ..
            05/30/2007  10:26 AM    <DIR>          bar
            05/30/2007  10:26 AM    <SYMLINKD>     tobar [\temp\test\bar]
            [..]

            C:\TEMP\test>dir bar
            [..]
             Directory of C:\TEMP\test\bar

            05/30/2007  10:26 AM    <DIR>          .
            05/30/2007  10:26 AM    <DIR>          ..
            05/30/2007  10:26 AM    <DIR>          subdir
            05/30/2007  10:26 AM    <SYMLINKD>     totest [\temp\test]
            [..]

            C:\TEMP\test>dir bar\subdir
            [..]
             Directory of C:\TEMP\test\bar\subdir

            05/30/2007  10:26 AM    <DIR>          .
            05/30/2007  10:26 AM    <DIR>          ..
            [..]


RMDIR /S
--------
	I also tried with 'rmdir /s'.. if you run that on a link,
	it just /removes the link/, as if the "/s" wasn't there.

	It does not appear to descend the link at all, and does not
	seem to affect the files/dirs the link points to.

	So I guess when you want to recursively remove stuff,
	you have to use the real directory name, not a link.

	You can 'rmdir /s' a directory that contains links, and
	the links themselves get deleted. I didn't check to see
	if those links it encounters within were followed;
	I imagine they're not. Proof:

            C:\TEMP\test>rmdir /s tobar
            tobar, Are you sure (Y/N)? y

            C:\TEMP\test>dir
            [..]
             Directory of C:\TEMP\test

            05/30/2007  10:28 AM    <DIR>          .
            05/30/2007  10:28 AM    <DIR>          ..
            05/30/2007  10:28 AM    <DIR>          bar
            [..]

            C:\TEMP\test>dir bar
            [..]
             Directory of C:\TEMP\test\bar

            05/30/2007  10:28 AM    <DIR>          .
            05/30/2007  10:28 AM    <DIR>          ..
            05/30/2007  10:28 AM                 6 aaa
            05/30/2007  10:28 AM                 6 bbb
            05/30/2007  10:28 AM    <DIR>          subdir
            05/30/2007  10:28 AM    <SYMLINKD>     totest [\temp\test]
            [..]

            C:\TEMP\test>dir bar\subdir
            [..]
             Directory of C:\TEMP\test\bar\subdir

            05/30/2007  10:28 AM    <DIR>          .
            05/30/2007  10:28 AM    <DIR>          ..
            05/30/2007  10:28 AM                 6 ccc
            05/30/2007  10:28 AM                 7 ddd
            [..]

DIR /S
------
	Trying 'dir /s' on a circular link tree caused it to loop
	forever, showing a bigger and bigger list until it reached
	a filename size limit, where it began truncating the pathnames,
	printing 'arglist too long' as it went.

	But it didn't stop, it just kept trying over and over forever.
	The good thing is that it doesn't run out of memory or crash,
	due to the filename limit. But you do have to hit ^C to stop it.

CAVEATS
-------
	YMMV! This is with Vista Business Edition, first release.

	MS could change this behavior, who knows? It's undocumented
	in 'del /?' and 'rmdir /?', so it's hard to know the philosophy
	from the designer's point of view, other than by observed behavior.

	DOS online docs never did achieve 'man page' nirvana.

	Maybe the docs will cover links in the future.
	But currently the del/rmdir docs are about as short as they were
	in the 80's.

-- 
Greg Ercolano, erco@(email surpressed)
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)
Fax: (Tel# suppressed)
Cel: (Tel# suppressed)

[this post was edited slightly on 06/01/2007 to improve clarity -erco]

   From: Luke Cole <luke@(email surpressed).au>
Subject: Re: [WINDOWS/ADMIN] Windows Vista: real symbolic links..?
   Date: Wed, 30 May 2007 21:02:43 -0400
Msg# 1566
View Complete Thread (6 articles) | All Threads
Last Next
	Good question.. you mean "del /s", right?

	No, in all the tests I tried (below) making circular 'directory'
	links (mklink /d), it behaves well with both 'del /s' and 'rmdir /s'
	it would seem.

	The only command I was able to get to loop forever was 'dir /s'.

Very interesting findings - thank you Greg for your detailed reply!

---
Luke Cole
Research & Development

FUEL International
65 King St., Newtown, Sydney NSW, Australia 2042