[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 261926] amarok collection scan does not follow symlinks
From:       <dim.kde () gmail ! com>
Date:       2011-03-21 10:27:42
Message-ID: 20110321102742.466D583580 () immanuel ! kde ! org
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=261926





--- Comment #11 from  <dim kde gmail com>  2011-03-21 11:27:38 ---
Created an attachment (id=58207)
 --> (http://bugs.kde.org/attachment.cgi?id=58207)
Patch that seems to correct the symlink problem

Hello,

As I really wanted to use the symlink of git-annex, I searched a little and I
found this commit of Jeff Mitchell (at the bottom) had resolved this problem
the first time. As this modification was squashed, I try to backport this in
the 2.4.0 version and it seems to works succesfully for me. The patch is in
attachment.

As I'm not a developper and even less a c++ developper, you should be carefully
about those modification ;).

Thank you,

Dimitri

commit 30c85f027557318d1c64b6b19c46903f62eaa4e4
Author: Jeff Mitchell <mitchell@kde.org>
Date:   Fri Aug 27 16:51:28 2010 -0400

    Resolving directories' symlinks during scanning meant that directories
could be seen as "out of the collection" and show up during full scans but
disappear during incremental scans.

    Thanks to tampakrap (Theo Chatzimichos) for helping track this down.

diff --git a/utilities/collectionscanner/CollectionScanner.cpp
b/utilities/collectionscanner/CollectionScanner.cpp
index f0cef67..cbe55a1 100644
--- a/utilities/collectionscanner/CollectionScanner.cpp
+++ b/utilities/collectionscanner/CollectionScanner.cpp
@@ -379,12 +379,10 @@ CollectionScanner::readDir( const QString& dir,
QStringList& entries )
     QStringList recurseDirs;
     foreach( const QFileInfo &fi, list )
     {
-        if( !fi.exists() )
+        if( !fi.exists() || ( fi.isSymLink() && !QFileInfo( fi.symLinkTarget()
).exists() ) )
             break;

-        const QFileInfo &f = fi.isSymLink() ? QFileInfo( fi.symLinkTarget() )
: fi;
-
-        if( f.isDir() && m_recursively && !m_scannedFolders.contains(
f.canonicalFilePath() ) )
+        if( fi.isDir() && m_recursively && !m_scannedFolders.contains(
fi.absoluteFilePath() ) )
         {
             //The following D-Bus call is used to see if a found folder is new
or not
             //During an incremental scan the scanning isn't really recursive,
as all folders
@@ -395,16 +393,16 @@ CollectionScanner::readDir( const QString& dir,
QStringList& entries )
             bool isInCollection = false;
             if( m_incremental && m_amarokCollectionInterface )
             {
-                QDBusReply<bool> reply = m_amarokCollectionInterface->call(
"isDirInCollection", f.canonicalFilePath() );
+                QDBusReply<bool> reply = m_amarokCollectionInterface->call(
"isDirInCollection", fi.absoluteFilePath() );
                 if( reply.isValid() )
                     isInCollection = reply.value();
             }

             if( !m_incremental || !isInCollection )
-                recurseDirs << QString( f.absoluteFilePath() + '/' );
+                recurseDirs << QString( fi.absoluteFilePath() + '/' );
         }
-        else if( f.isFile() )
-            entries.append( f.absoluteFilePath() );
+        else if( fi.isFile() )
+            entries.append( fi.absoluteFilePath() );
     }
     foreach( const QString &dir, recurseDirs )
         readDir( dir, entries );

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic