Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com To: cygwin-developers AT sourceware DOT cygnus DOT com Subject: Re: symlink() bug + patch References: <00F8D6E8AB0DD3118F1A006008186C9607C7EC AT server1 DOT axonet DOT com DOT au> Mime-Version: 1.0 (generated by tm-edit 7.106) Content-Type: text/plain; charset=US-ASCII From: Kazuhiro Fujieda Date: 23 Dec 1999 23:01:52 +0900 In-Reply-To: Andrew Dalgleish's message of Fri, 17 Dec 1999 19:03:12 +1100 Message-ID: Lines: 29 X-Mailer: Gnus v5.3/Emacs 19.34 >>> On Fri, 17 Dec 1999 19:03:12 +1100 >>> Andrew Dalgleish said: > There is a bug in symlink() if "path2" (SUSV2 docs) already exists. > If path2 is already a symlink, then the target of that symlink is > replaced instead of path2. (snip) > Here is a patch to make symlink() behave correctly. > (ie return -1 and set errno to EEXIST) This patch can't affect the case path2 is a symlink of which target is lost. The following session in the latest snapshot is almost the same as your example except for the initial `touch foo'. $ ln -s foo bar $ tar cf hum bar $ ls -l lrw-r--r-- 1 fujieda Domain U 14 Dec 23 22:49 bar -> foo -rw-r--r-- 1 fujieda Domain U 10240 Dec 23 22:49 hum $ tar xf hum $ ls -l lrw-r--r-- 1 fujieda Domain U 14 Dec 23 22:49 bar -> foo lrw-r--r-- 1 fujieda Domain U 14 Dec 23 22:50 foo -> foo -rw-r--r-- 1 fujieda Domain U 10240 Dec 23 22:49 hum ____ | AIST Kazuhiro Fujieda | HOKURIKU School of Information Science o_/ 1990 Japan Advanced Institute of Science and Technology