SVN commit 715315 by dfaure: Fix extraction of symlinks from tar/zip files when using copyTo() - at least at the KArchive level. Unit tests in trunk. CCBUG: 149903 M +25 -15 karchive.cpp --- branches/KDE/3.5/kdelibs/kio/kio/karchive.cpp #715314:715315 @@ -626,22 +626,32 @@ dirEntries = curDir->entries(); for ( it = dirEntries.begin(); it != dirEntries.end(); ++it ) { curEntry = curDir->entry(*it); - if ( curEntry->isFile() ) { - curFile = dynamic_cast( curEntry ); - if (curFile) { - fileList.append( curFile ); - fileToDir.insert( curFile->position(), curDirName ); - } + if (!curEntry->symlink().isEmpty()) { + const QString linkName = curDirName+'/'+curEntry->name(); + kdDebug() << "symlink(" << curEntry->symlink() << ',' << linkName << ')'; +#ifdef Q_OS_UNIX + if (!::symlink(curEntry->symlink().local8Bit(), linkName.local8Bit())) { + kdDebug() << "symlink(" << curEntry->symlink() << ',' << linkName << ") failed:" << strerror(errno); + } +#endif + } else { + if ( curEntry->isFile() ) { + curFile = dynamic_cast( curEntry ); + if (curFile) { + fileList.append( curFile ); + fileToDir.insert( curFile->position(), curDirName ); + } + } + + if ( curEntry->isDirectory() ) + if ( recursiveCopy ) { + KArchiveDirectory *ad = dynamic_cast( curEntry ); + if (ad) { + dirStack.push( ad ); + dirNameStack.push( curDirName + "/" + curEntry->name() ); + } + } } - - if ( curEntry->isDirectory() ) - if ( recursiveCopy ) { - KArchiveDirectory *ad = dynamic_cast( curEntry ); - if (ad) { - dirStack.push( ad ); - dirNameStack.push( curDirName + "/" + curEntry->name() ); - } - } } } while (!dirStack.isEmpty());