resolveSymlink patch

AuthTest AuthorizationTest <[email protected]>
Newsgroups gmane.text.doxygen.devel
Message-ID <[email protected]>
Hi, doxygen-develop.

The resolveSymlink function seem to work wrong. Suppose you have path like
../root/folder00/folder01, where ../root/folder00 is link to /tmp/folder02/.
First it will transform it to /tmp/folder02/folder01/ but still keep value
of oldPrefix equal to ../root/. Next it will transform tmp/ to /private/tmp/
and attach it to ../root/. The result would be
../root/private/tmp/folder02/folder01. I didn't equally have time and desire
to debug it further, but the reason I came to this was doxygen just hang out
on those kind of paths. So this looks like pretty significant bug.

You might want to consider my patch or just find your solution. It's just
odd that nobody got that behavior. Maybe I'm just doing something wrong. I
would appreciate any answer. Anyway, thank you for your time.

Regards
Iurii

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev

_______________________________________________
Doxygen-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/doxygen-develop
resolveSymlink.patch (application/octet-stream, 1.2 KB)
Index: src/doxygen.cpp
===================================================================
--- src/doxygen.cpp	(revision 741)
+++ src/doxygen.cpp	(working copy)
@@ -8612,6 +8612,7 @@
 static QCString resolveSymlink(QCString path)
 {
   int sepPos=0;
+  int oldPos=0;
   QFileInfo fi;
   QDict<void> nonSymlinks;
   QDict<void> known;
@@ -8635,7 +8636,8 @@
       if (fi.isSymLink())
       {
         QString target = fi.readLink();
-        if (QFileInfo(target).isRelative())
+        bool relative = QFileInfo(target).isRelative();
+        if (relative)
         {
           target = QDir::cleanDirPath(oldPrefix+"/"+target.data());
         }
@@ -8648,15 +8650,24 @@
           target+=result.mid(sepPos);
         }
         result = QDir::cleanDirPath(target).data();
-        sepPos = 0;
         if (known.find(result)) return QCString(); // recursive symlink!
         known.insert(result,(void*)0x8);
+        if (relative)
+        {
+          sepPos = oldPos;
+        }
+        else
+        {
+          sepPos = 0;
+          oldPrefix = "/";
+        }
       }
       else
       {
         nonSymlinks.insert(prefix,(void*)0x8);
+        oldPrefix = prefix;
       }
-      oldPrefix = prefix;
+      oldPos = sepPos;
     }
   }
   while (sepPos!=-1);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.