delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/09/12:17:42

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <26270112.post@talk.nabble.com>
Date: Mon, 9 Nov 2009 09:17:27 -0800 (PST)
From: aputerguy <nabble AT kosowsky DOT org>
To: cygwin AT cygwin DOT com
Subject: Re: Finding junction points in cygwin
In-Reply-To: <26269606.post@talk.nabble.com>
MIME-Version: 1.0
References: <26260606 DOT post AT talk DOT nabble DOT com> <416096c60911082351l7e3415e2s28f10549f3cf4136 AT mail DOT gmail DOT com> <20091109120333 DOT GF26344 AT calimero DOT vinschen DOT de> <26269606 DOT post AT talk DOT nabble DOT com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Actually the behavior is even stranger... renaming and then deleting
junctions creates spurious directories.

echo "This is a test file" >| targetfile
mkdir targetdir
echo "This is a test dir file" >| targetdir/targetdirfile

junction.exe junctionfile targetfile
junction.exe junctiondir targetdir

ls -Ag
drwxr-xr-x 1 None  0 2009-11-09 11:56 junctiondir/
-rw-r--r-- 1 None 20 2009-11-09 11:55 junctionfile
drwxr-xr-x 1 None  0 2009-11-09 11:56 targetdir/
-rw-r--r-- 1 None 20 2009-11-09 11:55 targetfile

mv junctionfile newjunctionfile
mv junctiondir newjunctiondir

ls -Ag 
drwxr-xr-x 1 ????????  0 2009-11-09 11:57 junctiondir/
drwxr-xr-x 1 ????????  0 2009-11-09 11:57 junctionfile/
drwxr-xr-x 1 None      0 2009-11-09 11:56 newjunctiondir/
-rw-r--r-- 1 None     20 2009-11-09 11:55 newjunctionfile

junction.exe -d junctionfile
junction.exe -d junctiondir

ls -Ag
drwxr-xr-x  1 None  0 2009-11-09 11:56 newjunctiondir/
-rw-r--r--  1 None 20 2009-11-09 11:55 newjunctionfile
drwx------+ 1 None  0 2009-11-09 12:01 targetdir/
drwx------+ 1 None  0 2009-11-09 12:01 targetfile/

Now this seems to be sheer madness.
The original file and directory names have reappeared!
However 'targetdir' is now empty and 'targetfile' is also an (empty)
directory!


ls -Ag targetdir targetfile newjunctiondir
newjunctiondir:
total 1
-rw-r--r-- 1 None 24 2009-11-09 11:56 targetdirfile

targetdir:
total 0

Interestingly, in Windows explorer, renaming seems to do the right thing -
it renames the target.

Interestingly, Windows explorer allows both file and directory junctions to
be removed (though it displays file junctions as non-openable directories).
Not sure why it does this since I thought junctions could only be deleted
using '-d'.

So it seems to me, we have the following conclusions:
- cygwin treatment of junctions is not consistent with Windows or with
notion of symlinks. It also leaves weird residua after renaming junctions.
- Windows junctions are also messed up but not as much




targetfile:
total 0




-- 
View this message in context: http://old.nabble.com/Finding-junction-points-in-cygwin-tp26260606p26270112.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019