On Apr 16 17:47, Corinna Vinschen wrote: > On Apr 16 03:39, 卜勇华 wrote: > > Hi Corinna, > > > Please don't top-post. Thank you. > > > > Below is what I get: > > RS-I9E3U8R4:[~/tmp/test_symlink]>uname -a > > CYGWIN_NT-6.1 RS-I9E3U8R4 1.7.29(0.272/5/3) 2014-04-07 13:46 x86_64 Cygwin > > RS-I9E3U8R4:[~/tmp/test_symlink]>echo $CYGWIN > > winsymlinks:nativestrict > > RS-I9E3U8R4:[~/tmp/test_symlink]>echo test > test.txt > > RS-I9E3U8R4:[~/tmp/test_symlink]>mkdir dest > > RS-I9E3U8R4:[~/tmp/test_symlink]>cd dest > > RS-I9E3U8R4:[~/tmp/test_symlink/dest]>ln -s ../test.txt test.txt > > RS-I9E3U8R4:[~/tmp/test_symlink/dest]>cd ../ > > RS-I9E3U8R4:[~/tmp/test_symlink]>mkdir src > > RS-I9E3U8R4:[~/tmp/test_symlink]>cd src > > RS-I9E3U8R4:[~/tmp/test_symlink/src]>ln -s ../dest dest > > RS-I9E3U8R4:[~/tmp/test_symlink/src]>cd ../ > > RS-I9E3U8R4:[~/tmp/test_symlink]>cat src/dest/test.txt > > cat: src/dest/test.txt: No such file or directory > > I can reproduce it now. I made a mistake when creating the symlinks > the first time, which is, I created them with tcsh. Tcsh tends to > change relative paths using ".." components to absolute paths on the > command line. Using plain relative paths, I now see what's going on. > > But it'sa tricky problem. I don't know how to fix it yet. I'll > have to think about it, so please be patient.
This is a very interesting problem which (again) shows the downsides of the Cygwin path handling, namely the evaluation of the path from right to left, contrary to what POSIX demands. We really have to rewrite this code, but that's a lot of work for long and dark winter nights and days, not something we can do out of the blue. Therefore, I created a workaround within the constraints of the current code. Please try the today's snapshot from http://cygwin.com/snapshots/, it contains my workaround. Note that in the current configuration we're having a recursion problem. If your path consists of more than 15 native symlinks, all of which have a ".." path component in the symlink target path, the result will be a "no such file or directory" again. This is pretty unlikely in normal life, but can be easily constructed, of course. Thanks, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
pgpkZlmdadkhE.pgp
Description: PGP signature