Version: 1.4.0a (using KDE KDE 3.5.2) Installed from: Fedora RPMs OS: Linux Amarok follows symlinks. On collections that have folders of "favorite" songs stored as symlinks, this causes N songs to appear in the collection. Thus, ratings for one song are inconsistent and spread among different files. We need an option to avoid this. Patch attached
Created attachment 16564 [details] Make amarok not follow symlinks This patch enables amarok to skip symlinks when reading the collection.
Further discussion at: http://rudd-o.com/archives/2006/06/12/amarok-follows-symbolic-links-no-problem/
SVN commit 565974 by aoliveira: Collection Scanner resolves symlinks, what avoids duplicating files when there's links that point to other folders inside of the collection. Please test, this might create problems. BUG: 129018 M +12 -0 collectionscanner.cpp --- trunk/extragear/multimedia/amarok/src/collectionscanner/collectionscanner.cpp #565973:565974 @@ -27,6 +27,8 @@ #include <iostream> #include <dirent.h> //stat +#include <limits.h> //PATH_MAX +#include <stdlib.h> //realpath #include <taglib/audioproperties.h> #include <taglib/fileref.h> @@ -150,6 +152,7 @@ const QCString dir8Bit = QFile::encodeName( dir ); struct stat statBuf; + struct stat statBuf_symlink; stat( dir8Bit, &statBuf ); struct direntry de; @@ -197,6 +200,8 @@ if ( stat( entry, &statBuf ) != 0 ) continue; + if ( lstat( entry, &statBuf_symlink ) != 0 ) + continue; // loop protection if ( ! ( S_ISDIR( statBuf.st_mode ) || S_ISREG( statBuf.st_mode ) ) ) @@ -204,6 +209,13 @@ if ( S_ISDIR( statBuf.st_mode ) && m_recursively && entry.length() && entryname[0] != '.' ) { + if ( S_ISLNK( statBuf_symlink.st_mode ) ) { + char nosymlink[PATH_MAX]; + if ( realpath( entry, nosymlink ) ) { + debug() << entry << " is a symlink. Using: " << nosymlink << endl; + entry = nosymlink; + } + } const QString file = QFile::decodeName( entry ); bool isInCollection = false;