symlink() bug + patch

Kazuhiro Fujieda fujieda@jaist.ac.jp
Thu Dec 23 06:02:00 GMT 1999


>>> On Fri, 17 Dec 1999 19:03:12 +1100
>>> Andrew Dalgleish <andrewd@axonet.com.au> 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 <fujieda@jaist.ac.jp>
  | HOKURIKU  School of Information Science
o_/ 1990      Japan Advanced Institute of Science and Technology


More information about the Cygwin-developers mailing list