Bug 217002 - "move to collection" can delete files from collection
Summary: "move to collection" can delete files from collection
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Collections/Local (show other bugs)
Version: 2.3.0
Platform: Debian testing Linux
: VHI grave
Target Milestone: 2.4.0
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-02 00:02 UTC by Valerian
Modified: 2011-02-01 11:01 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.3.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Valerian 2009-12-02 00:02:32 UTC
Version:           2.2.1 (using KDE 4.3.2)
OS:                Linux
Installed from:    Debian testing/unstable Packages

I tried to move several files "to collection".
but no files appear at the destination, yet they disappear from the source.

things i find are: new directory (where files should have appeared) and misleading information in collection browser (about files location... it say that files are where i want them to be...).

files were flac with all vital tags filled.
should be no problems with filenames.
files were in collecton (just in wrong plase).

i think this is bad:
even if i assume that i should not "move to collection" files from collection,
i want to see at least some warning (to move them to the right plase is better).
Comment 1 Myriam Schweingruber 2009-12-02 09:17:15 UTC
Did you try a full rescan, then restart Amarok?

FWIW, if you want to reorganize the physical location of your collection, a file browser is definitely the better choice, then just updating the collection makes the files show up.
Comment 2 Valerian 2009-12-02 11:28:43 UTC
I thought that my collection status can be useerful so no.
also i think no collection rescan can bring dead files to life.
if you want then:
when i rescan my collection right now: files disappear from collection also!

i know that i should use some other tools (not col.br.) to locate my files, but
i think files were deleted physically from hdd (i also find some increase in free space (according to total size of files)).

it can be that i can't find my files (and new directory appear just to make thing worse, also from nowhere free space appear (1 Gb)).
but then i do not know where to look for them.

something like:
locate %partofoldfilename
show:
/var/tmp/kdecache-%username/http/l/lyrics.wikia.com_%artist:%title_32e8ed6b
and nothing more...

i have some more files to "move to collection" in my collection.
same thing... they disappear (of course i copied files somewhere beforehand).
and when i "move to collection" them from other place evreything came out as i want.
Comment 3 Valerian 2009-12-02 11:43:08 UTC
also: there is one file that was moved well.
things special about this file:
i changed filename (added "_") before moving.

(this was first part of track (really containing 2 track) and second part disappear... yet they were created similarly)
Comment 4 Myriam Schweingruber 2009-12-17 16:09:47 UTC
Subscribing Max and Jeff, no idea what is wrong here.
Comment 5 Jeff Mitchell 2009-12-17 17:02:26 UTC
I don't deal with the organize collection dialog.
Comment 6 Myriam Schweingruber 2010-01-06 20:43:53 UTC
Adding keyword.
Comment 7 Andrew Ash 2010-01-14 06:37:18 UTC
Still happening in the just-released 2.2.2?  Make sure to have a backup of your files first of course!
Comment 8 Myriam Schweingruber 2010-01-14 11:27:02 UTC
Andrew, please don't forget to change the status when asking :)
Comment 9 Valerian 2010-01-14 20:29:52 UTC
(In reply to comment #7)
> Still happening in the just-released 2.2.2?  Make sure to have a backup of your
> files first of course!

yes, still happening.
also. i opened (in mplayer for playing) one file before "moving to collection" and look (by lsof) at the opened files after.
mplayer ### %myself #r REG ###,# ### ### %full_Desired_filename (deleted)

of course the file opened in mplayer was %full_Old_filename (different from %full_Desired_filename) and ,as usual, directory for album appear.
Comment 10 Myriam Schweingruber 2010-01-14 21:37:05 UTC
Thank you for the feedback.
Comment 11 Marc Puig Pasarrius 2010-01-15 00:05:45 UTC
Files are copied successfully to the destination folder, but after some seconds
something deletes them. I'm trying to see why...
Comment 12 Maximilian Kossick 2010-01-15 08:37:58 UTC
are you selecting the "move to collection" option in Amarok's file browser (the one that shows file icons and directories on you harddisk)? or from within the collection browser?
Comment 13 Marc Puig Pasarrius 2010-01-15 13:13:04 UTC
(In reply to comment #12)
> are you selecting the "move to collection" option in Amarok's file browser (the
> one that shows file icons and directories on you harddisk)? or from within the
> collection browser?

I select the option from the file browser. In collection browser move doesn't appear (only copy) or at least I can't find it.
Comment 14 Myriam Schweingruber 2010-01-15 15:23:12 UTC
(In reply to comment #13)
...
> I select the option from the file browser. In collection browser move doesn't
> appear (only copy) or at least I can't find it.

It should be right beneath the Copy to Collection item in the Context menu. If you can't see that entry then something might not be right with your installation...
Comment 15 Maximilian Kossick 2010-01-15 17:56:41 UTC
(In reply to comment #14)
> (In reply to comment #13)
> ...
> > I select the option from the file browser. In collection browser move doesn't
> > appear (only copy) or at least I can't find it.
> 
> It should be right beneath the Copy to Collection item in the Context menu. If
> you can't see that entry then something might not be right with your
> installation...

No, it won't be shown in the collection browser if there is no other collection to move them to, e.g. if there is only the local collection.

"Copy to Collection" is shown even if there is no other collection (in the unified view only), which is a bug. Copying tracks from the local collection to the local collection just does not make sense.
Comment 16 Maximilian Kossick 2010-01-15 19:15:33 UTC
commit 44c67d3ff88ef07ad0860fe2b035592cff78e9fa
Author: Maximilian Kossick <maximilian.kossick@googlemail.com>
Date:   Fri Jan 15 18:12:30 2010 +0100

    do not delete files that are actually in the local collection already when using "Move to collection" from the filebrowser
    
    ok, this one was tricky:
    DirectoryLoader tries to get TrackPtrs for the files to move ... ok
    CollectionManager figures out that they are in SqlCollection ... ok
    Create a FileCollectionLocation ... uh
    Move files to the SqlCollection ... ok
    Jeff's scanner code updates the playableUrl of the SqlTracks reated above ... ok
    FileCollectionLocation deletes the tracks by calling playableUrl() on the tracks which have jsut been updated ... oops
    
    lesson learned: do not use workarounds like FileCollectionLocation if you can do it properly
    
    BUG: 217002

diff --git a/ChangeLog b/ChangeLog
index f97eab8..a657bdd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -34,6 +34,8 @@ VERSION 2.2.3
       files which incorrectly have the same MusicBrainz unique identifier.
 
   BUGFIXES:
+    * Fixed a bug that was deleting files when using "Move to collection"
+      from the file browser. (BR 217002)
     * Allow fetching of album covers in the unified view. (BR 220873)
     * Lyrics applet: Fixed scrollbar incorrectly displayed (and sometimes not
       at all) for long lyrics under KDE 4.4. (BR 222260)
diff --git a/src/browsers/filebrowser/MyDirOperator.cpp b/src/browsers/filebrowser/MyDirOperator.cpp
index 330d82b..d2d9785 100644
--- a/src/browsers/filebrowser/MyDirOperator.cpp
+++ b/src/browsers/filebrowser/MyDirOperator.cpp
@@ -31,6 +31,7 @@
 #include <KAction>
 #include <QAbstractItemView>
 #include <QMenu>
+#include <QSet>
 
 
 MyDirOperator::MyDirOperator( const KUrl &url, QWidget *parent )
@@ -127,10 +128,31 @@ MyDirOperator::slotCopyTracks( const Meta::TrackList& tracks )
     if( !m_copyAction || !m_copyActivated )
         return;
 
-    CollectionLocation *source      = new FileCollectionLocation();
-    CollectionLocation *destination = m_copyAction->collection()->location();
+    QSet<Amarok::Collection*> collections;
+    foreach( const Meta::TrackPtr &track, tracks )
+    {
+        collections.insert( track->collection() );
+    }
+    if( collections.count() == 1 )
+    {
+        Amarok::Collection *sourceCollection = collections.values().first();
+        CollectionLocation *source;
+        if( sourceCollection )
+        {
+            source = sourceCollection->location();
+        }
+        else
+        {
+            source = new FileCollectionLocation();
+        }
+        CollectionLocation *destination = m_copyAction->collection()->location();
 
-    source->prepareCopy( tracks, destination );
+        source->prepareCopy( tracks, destination );
+    }
+    else
+    {
+        warning() << "Cannot handle copying tracks from multiple collections, doing nothing to be safe";
+    }
     m_copyActivated = false;
     m_copyAction = 0;
 }
@@ -141,10 +163,31 @@ MyDirOperator::slotMoveTracks( const Meta::TrackList& tracks )
     if( !m_moveAction || !m_moveActivated )
         return;
 
-    CollectionLocation *source      = new FileCollectionLocation();
-    CollectionLocation *destination = m_moveAction->collection()->location();
+    QSet<Amarok::Collection*> collections;
+    foreach( const Meta::TrackPtr &track, tracks )
+    {
+        collections.insert( track->collection() );
+    }
+    if( collections.count() == 1 )
+    {
+        Amarok::Collection *sourceCollection = collections.values().first();
+        CollectionLocation *source;
+        if( sourceCollection )
+        {
+            source = sourceCollection->location();
+        }
+        else
+        {
+            source = new FileCollectionLocation();
+        }
+        CollectionLocation *destination = m_moveAction->collection()->location();
 
-    source->prepareMove( tracks, destination );
+        source->prepareMove( tracks, destination );
+    }
+    else
+    {
+        warning() << "Cannot handle moving tracks from multipe collections, doing nothing to be safe";
+    }
     m_moveActivated = false;
     m_moveAction = 0;
Comment 17 Silvian Cretu 2010-03-21 22:04:25 UTC
This happened to me as well. I just upgraded to KDE 4.4.1 and Amarok 2.3.0 and this issue is still happening. I can send you a file to test with if that helps.
Comment 18 Sven Krohlas 2010-03-21 22:17:03 UTC
@Silvian: we are very, very sure this is fixed. Can you reproduce? What are the exact steps? Are you completely sure the file is missing from the disc and is just not being shown in the collection?
Comment 19 Silvian Cretu 2010-03-22 10:17:25 UTC
OK then, let me show how I could reproduce the bug.
The mp3 file that I tested is a bit large to be attached to this bug report. If needed, I can put it on a server for you to download it.

It was tagged with MusicBrainz Picard.

Amarok can't read the new tags unless I hit "Fully Rescan Entire Collection" (but this is another bug report). So I have all the collection rescanned and then I restarted Amarok.

My collection consists of two directories and their subdirectories:
/home/syl/Downloads (unsorted music)
/home/syl/Music (sorted music)

I right click on the original file from the File Browser and select Move to Collection > Local Collection. 

My goal is to move the file from Downloads to Music, from "/home/syl/Download/09. Aire.mp3" to "/home/syl/Music/Si_Sé/[2001] Si_Sé/07 - Aire.mp3" (%artist/{Collection root (Collection Folder = /home/syl/Music)/[%year] }%album/%track - %title.File Type).

I hit OK and I get "Do you really want to move this track? It will be renamed and the original deleted". I click Continue. The directory structure is created and the file is moved. 

I now have "/home/syl/Music/Si_Sé/[2001] Si_Sé/07 - Aire.mp3" and "/home/syl/Download/09. Aire.mp3" is missing. 

I am now asked: "Do you really want to delete this track? It will be removed from disk as well as your collection." If I click Delete, the file "/home/syl/Music/Si_Sé/[2001] Si_Sé/07 - Aire.mp3" is deleted.

So... what's the point of the second operation that Amarok does? Why am I asked to delete the track since the move operation completed successfully?

Thank you!
Comment 20 Maximilian Kossick 2010-03-22 12:13:01 UTC
Confirmed, AFT is being a bit too clever and changing the url of the track that is about to be deleted behind the back of the collection location.

Here's what's happening:

SqlCollectionLocation moves track A from location B to location C
AFT comes along and changes the url of A from B to C.
SqlCollectionLocation tries to remove the original track, but uses the url of A for that, which now points at C instead of B.
Comment 21 Jeff Mitchell 2010-03-22 15:10:53 UTC
AFT only runs during collection scanning. How is it at fault here?
Comment 22 Maximilian Kossick 2010-03-22 15:23:13 UTC
because SqlCollectionLocation has always been using
ScanResultProcessor to insert tracks into the database (see
SqlCollectionLocation::insertTracks).

On Mon, Mar 22, 2010 at 3:10 PM, Jeff Mitchell <mitchell@kde.org> wrote:
> https://bugs.kde.org/show_bug.cgi?id=217002
>
>
>
>
>
> --- Comment #21 from Jeff Mitchell <mitchell kde org>  2010-03-22 15:10:53 ---
> AFT only runs during collection scanning. How is it at fault here?
>
> --
> Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug.
>
Comment 23 Jeff Mitchell 2010-03-22 16:51:34 UTC
OK. So how is that AFT's fault that SqlCollection is using code intended for another purpose?
Comment 24 Jeff Mitchell 2010-03-22 17:06:12 UTC
Also, re-reading comment #20, it seems like the end result should not be files being deleted from the collection but simply the file at the new location being deleted and the file at the old location being fine, but that doesn't appear to be the behavior indicated by the OP.

Also from comment #20, it seems like AFT is actually doing exactly what it *should* be doing. If the track's physical location changes on disk, you *want* the URL to be updated in the database. AFAICT the problem lies in SqlCollectionLocation making assumptions about the state of the track, and should be fixed by having SqlCollectionLocation remember the old URL and use that in its deletion. A simple QMap/QHash of the track to the old URL should suffice.
Comment 25 Silvian Cretu 2010-03-22 17:52:05 UTC
(In reply to comment #24)
> Also, re-reading comment #20, it seems like the end result should not be files
> being deleted from the collection but simply the file at the new location being
> deleted and the file at the old location being fine, but that doesn't appear to
> be the behavior indicated by the OP.

As I said, after hitting OK (in order to Move the file into a collection subfolder), I'm being asked "Do you really want to move this track? It will be renamed and the original deleted". By clicking OK, I get what I need. The original file is copied where I want it to be and then the original file is deleted.
It's the second operation initiated by Amarok that deletes the freshly moved file: "Do you really want to delete this track? It will be removed
from disk as well as your collection." Hitting Cancel here leaves the freshly moved file intact.
Comment 26 Jeff Mitchell 2010-03-22 18:45:06 UTC
OK. That makes sense. Still seems like a SqlCollectionLocation problem to me.
Comment 27 Jeff Mitchell 2010-03-26 20:46:09 UTC
commit 77cd97986356e10257de9e4920493ab943c68fd4
Author: Jeff Mitchell <mitchell@kde.org>
Date:   Fri Mar 26 15:43:11 2010 -0400

    Don't assume that the URL of a track will be the same after a move...delete the old path, not the path it's at now.
    
    Do please test this and make sure that it's correctly fixed.
    
    BUG: 217002

diff --git a/ChangeLog b/ChangeLog
index feca4d1..a04ff0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -44,6 +44,8 @@ VERSION 2.3.1-Beta 1
        some MySQL versions. (BR 225052)
 
   BUGFIXES:
+     * Fixed organize collection dialog deleting tracks at new location
+       instead of old. (BR 217002)
      * Fixed a broken podcast feed that had a minor compliance issue in date
        format. (BR 231062)
      * Fixed "files" bookmarks not storing the actual path shown in the file 
diff --git a/src/collection/sqlcollection/SqlCollectionLocation.cpp b/src/collection/sqlcollection/SqlCollectionLocation.cpp
index 6205652..be5971a 100644
--- a/src/collection/sqlcollection/SqlCollectionLocation.cpp
+++ b/src/collection/sqlcollection/SqlCollectionLocation.cpp
@@ -125,14 +125,16 @@ SqlCollectionLocation::remove( const Meta::TrackPtr &track )
     {
         debug() << "much much";
         bool removed;
+        KUrl originalUrl = m_originalUrls[track];
         // we are going to delete it from the database only if is no longer on disk
-        removed = !QFile::exists( sqlTrack->playableUrl().path() );
+        removed = !QFile::exists( originalUrl.path() );
 
         if( removed )
         {
-
+            int deviceId = m_collection->mountPointManager()->getIdForUrl( originalUrl );
+            QString rpath = m_collection->mountPointManager()->getRelativePath( deviceId, originalUrl.url() );
             QString query = QString( "SELECT id FROM urls WHERE deviceid = %1 AND rpath = '%2';" )
-                                .arg( QString::number( sqlTrack->deviceid() ), m_collection->sqlStorage()->escape( sqlTrack->rpath() ) );
+                                .arg( QString::number( deviceId ), m_collection->sqlStorage()->escape( rpath ) );
             QStringList res = m_collection->sqlStorage()->query( query );
             if( res.isEmpty() )
             {
@@ -147,7 +149,7 @@ SqlCollectionLocation::remove( const Meta::TrackPtr &track )
         }
         if( removed )
         {
-            QFileInfo file( sqlTrack->playableUrl().path() );
+            QFileInfo file( m_originalUrls[track].path() );
             QDir dir = file.dir();
             const QStringList collectionFolders = m_collection->mountPointManager()->collectionFolders();
             while( !collectionFolders.contains( dir.absolutePath() ) && !dir.isRoot() && dir.count() == 0 )
@@ -163,7 +165,7 @@ SqlCollectionLocation::remove( const Meta::TrackPtr &track )
     }
     else
     {
-        debug() << "Remove Failed: track exists on disk." << sqlTrack->playableUrl().path();
+        debug() << "Remove Failed: track exists on disk." << m_originalUrls[track].path();
         return false;
     }
 }
@@ -323,6 +325,7 @@ void SqlCollectionLocation::slotTransferJobFinished( KJob* job )
     {
         if( !QFileInfo( m_destinations[ track ] ).exists() )
             m_destinations.remove( track );
+        m_originalUrls[track] = track->playableUrl();
     }
     insertTracks( m_destinations );
     insertStatistics( m_destinations );
@@ -342,6 +345,7 @@ void SqlCollectionLocation::slotTransferJobAborted()
     {
         if( !QFileInfo( m_destinations[ track ] ).exists() )
             m_destinations.remove( track );
+        m_originalUrls[track] = track->playableUrl();
     }
     insertTracks( m_destinations );
     insertStatistics( m_destinations );
@@ -561,7 +565,7 @@ bool SqlCollectionLocation::startNextRemoveJob()
     while ( !m_removetracks.isEmpty() )
     {
         Meta::TrackPtr track = m_removetracks.takeFirst();
-        KUrl src = track->playableUrl();
+        KUrl src = m_originalUrls[track];
 
         KIO::DeleteJob *job = 0;
 
diff --git a/src/collection/sqlcollection/SqlCollectionLocation.h b/src/collection/sqlcollection/SqlCollectionLocation.h
index 399e523..4794d20 100644
--- a/src/collection/sqlcollection/SqlCollectionLocation.h
+++ b/src/collection/sqlcollection/SqlCollectionLocation.h
@@ -104,6 +104,7 @@ class SqlCollectionLocation : public CollectionLocation
         QMap<Meta::TrackPtr, QString> m_destinations;
         QMap<Meta::TrackPtr, KUrl> m_sources;
         Meta::TrackList m_removetracks;
+        QHash<Meta::TrackPtr, KUrl> m_originalUrls;
         bool m_overwriteFiles;
         QMap<KJob*, Meta::TrackPtr> m_jobs;
         QMap<KJob*, Meta::TrackPtr> m_removejobs;
Comment 28 Silvian Cretu 2010-06-09 11:21:44 UTC
The problem is still not fixed. This is how Amarok 2.3.1 behaves now:

I right click on the original file from the File Browser and select Move to
Collection > Local Collection. I get the message "Do you really want to move this track? It will be renamed and the original deleted." I click Continue. The file is being moved but I get the message "There was a problem and this track could not be removed. Make sure the directory is writeable." The file displayed is at the new location. So, Amarok actually tries to delete the successfully moved file. Luckily it doesn't succeed.
Comment 29 Myriam Schweingruber 2010-06-09 12:01:40 UTC
Oops, not good, thanks for checking.
Comment 30 Sergey Ivanov 2010-12-02 15:12:39 UTC
Is this bug still persist? Can't reproduce It. Or there are some special terms?
Tried with unwritable destination directory, with unwritable source directory, with unwritable source/destination files, nothing happens.

Fresh GIT version.
Comment 31 Ognyan Angelov 2010-12-06 16:55:03 UTC
Setup:
  Amarok 2.3.2
  KDE 4.4.5
Test Result:
  Fixed in 2.3.2.
I can't reproduce the bug on 2.3.2
Comment 32 Myriam Schweingruber 2010-12-06 18:12:20 UTC
Closing as fixed. Feel free to reopen if you can reproduce this with Amarok 2.4 beta to be released this week.
Comment 33 Silvian Cretu 2011-01-17 18:35:47 UTC
The problem was fixed on 2.3.2 as it worked perfectly for me. Now I've just upgraded to 2.4 and the problem reappeared. 

How to reproduce?
Go to Media Sources > Local Music > right click on a song > Organize Files > click OK to move it from one directory to the other. The new path will be created but the file will be deleted before being moved to the new path. A few seconds later, once Collection Scanner kicks in, Amarok will crash.

Tested on Kubuntu 10.10, KDE 4.5.1 (Kubuntu default), Amarok 2.4.0 (Kubuntu Backports PPA)

Output from amarok --debug. You can clearly see that the file being deleted is the new moved one (I wanted to move the file from ~/Download/174... to ~/Music/Rolling Stones, The/[1966]...):

amarok: BEGIN: void Collections::CollectionLocation::queryDone() 
amarok:   [CollectionLocation] we were about to move something, lets proceed 
amarok:   BEGIN: void Collections::CollectionLocation::prepareMove(const Meta::TrackList&, Collections::CollectionLocation*) 
amarok:     BEGIN: virtual bool Collections::SqlCollectionLocation::isWritable() const 
amarok:       [SqlCollectionLocation] "/home/syl/Download" 
amarok:       [SqlCollectionLocation]   used:  2.93388e+11 
amarok:       [SqlCollectionLocation]   total:  2.95854e+11 
amarok:       [SqlCollectionLocation]   free space:  2.46602e+09 
amarok:       [SqlCollectionLocation]   path_exists_writeable true 
amarok:       [SqlCollectionLocation]   path_exists_with_space true 
amarok:       [SqlCollectionLocation] "/home/syl/Music" 
amarok:       [SqlCollectionLocation]   used:  2.93388e+11 
amarok:       [SqlCollectionLocation]   total:  2.95854e+11 
amarok:       [SqlCollectionLocation]   free space:  2.46602e+09 
amarok:       [SqlCollectionLocation]   path_exists_writeable true 
amarok:       [SqlCollectionLocation]   path_exists_with_space true 
amarok:     END__: virtual bool Collections::SqlCollectionLocation::isWritable() const [Took: 0s] 
amarok:     BEGIN: void Collections::CollectionLocation::startWorkflow(const Meta::TrackList&, bool) 
amarok:       BEGIN: virtual void Collections::SqlCollectionLocation::showDestinationDialog(const Meta::TrackList&, bool, const Transcoding::Configuration&) 
amarok:         [SqlCollectionLocation] Path "/home/syl/Download" 
amarok:         [SqlCollectionLocation] used: 293387935744 
amarok:         [SqlCollectionLocation] total: 295853944832 
amarok:         [SqlCollectionLocation] Free space 2466009088 
amarok:         [SqlCollectionLocation] transfersize 5519863 
amarok:         [SqlCollectionLocation] 2460489225 
amarok:         [SqlCollectionLocation] Path "/home/syl/Music" 
amarok:         [SqlCollectionLocation] used: 293387935744 
amarok:         [SqlCollectionLocation] total: 295853944832 
amarok:         [SqlCollectionLocation] Free space 2466009088 
amarok:         [SqlCollectionLocation] transfersize 5519863 
amarok:         [SqlCollectionLocation] 2460489225 
amarok:         about to infer! 
amarok:         Advanced 
amarok:         BEGIN: void OrganizeCollectionDialog::preview(const QString&) 
amarok:           format "%folder/%artist/{[%year] }%album/{Disc %discnumber}/{%track - }{%artist - }%title.%filetype" 
amarok:           dests.size() 1 
amarok:           dests QMap((true, "/home/syl/Music/Rolling Stones, The/[1966] Aftermath//01 - Rolling Stones, The - Paint It, Black.mp3")) 
amarok:           i: 0 
amarok:         END__: void OrganizeCollectionDialog::preview(const QString&) [Took: 0.004s] 
amarok:       END__: virtual void Collections::SqlCollectionLocation::showDestinationDialog(const Meta::TrackList&, bool, const Transcoding::Configuration&) [Took: 0.12s] 
amarok:     END__: void Collections::CollectionLocation::startWorkflow(const Meta::TrackList&, bool) [Took: 0.12s] 
amarok:   END__: void Collections::CollectionLocation::prepareMove(const Meta::TrackList&, Collections::CollectionLocation*) [Took: 0.12s] 
amarok: END__: void Collections::CollectionLocation::queryDone() [Took: 0.12s] 
amarok: BEGIN: void Collections::SqlCollectionLocation::slotDialogAccepted() 
amarok:   BEGIN: virtual void Collections::CollectionLocation::getKIOCopyableUrls(const Meta::TrackList&) 
amarok:     [CollectionLocation] adding url  KUrl("file:///home/syl/Download/174 - The Rolling Stones - Paint It Black.mp3") 
amarok:     [CollectionLocation] Format is  0 
amarok:     BEGIN: void Collections::CollectionLocation::slotStartCopy(const QMap<KSharedPtr<Meta::Track>, KUrl>&, const Transcoding::Configuration&) 
amarok:       BEGIN: virtual void Collections::SqlCollectionLocation::copyUrlsToCollection(const QMap<KSharedPtr<Meta::Track>, KUrl>&, const Transcoding::Configuration&) 
amarok:         [ScanManager] Abort scan:  "Scan blocked" 
amarok:         [SqlCollectionLocation] TransferJob::TransferJob 
amarok:         BEGIN: virtual void Collections::TransferJob::start() 
amarok:         END__: virtual void Collections::TransferJob::start() [Took: 0s] 
amarok:       END__: virtual void Collections::SqlCollectionLocation::copyUrlsToCollection(const QMap<KSharedPtr<Meta::Track>, KUrl>&, const Transcoding::Configuration&) [Took: 0s] 
amarok:     END__: void Collections::CollectionLocation::slotStartCopy(const QMap<KSharedPtr<Meta::Track>, KUrl>&, const Transcoding::Configuration&) [Took: 0s] 
amarok:   END__: virtual void Collections::CollectionLocation::getKIOCopyableUrls(const Meta::TrackList&) [Took: 0s] 
amarok: END__: void Collections::SqlCollectionLocation::slotDialogAccepted() [Took: 1.3s] 
amarok: BEGIN: virtual OrganizeCollectionDialog::~OrganizeCollectionDialog() 
amarok: END__: virtual OrganizeCollectionDialog::~OrganizeCollectionDialog() [Took: 0s] 
amarok: BEGIN: void Collections::TransferJob::doWork() 
amarok:   BEGIN: bool Collections::SqlCollectionLocation::startNextJob(Transcoding::Configuration) 
amarok:     [SqlCollectionLocation] copying from  KUrl("file:///home/syl/Download/174 - The Rolling Stones - Paint It Black.mp3")  to  KUrl("file:///home/syl/Music/Rolling Stones, The/[1966] Aftermath/01 - Rolling Stones, The - Paint It, Black.mp3") 
amarok:     [SqlCollectionLocation] moving! 
amarok:   END__: bool Collections::SqlCollectionLocation::startNextJob(Transcoding::Configuration) [Took: 0.028s] 
amarok: END__: void Collections::TransferJob::doWork() [Took: 0.028s] 
amarok: BEGIN: void Collections::SqlCollectionLocation::slotJobFinished(KJob*) 
amarok: END__: void Collections::SqlCollectionLocation::slotJobFinished(KJob*) [Took: 0s] 
amarok: BEGIN: void Collections::TransferJob::slotJobFinished(KJob*) 
amarok:   [SqlCollectionLocation] processed 1  totalAmount 1 
amarok:   BEGIN: bool Collections::SqlCollectionLocation::startNextJob(Transcoding::Configuration) 
amarok:   END__: bool Collections::SqlCollectionLocation::startNextJob(Transcoding::Configuration) [Took: 0s] 
amarok:   [SqlCollectionLocation] sources empty 
amarok:   BEGIN: void Collections::SqlCollectionLocation::slotTransferJobFinished(KJob*) 
amarok:     [SqlCollectionLocation] SqlCollectionLocation::insert from: KUrl("file:///home/syl/Download/174 - The Rolling Stones - Paint It Black.mp3") to "/home/syl/Music/Rolling Stones, The/[1966] Aftermath//01 - Rolling Stones, The - Paint It, Black.mp3" 
amarok:     [SqlCollectionLocation] File on disk, insert to dbase "Paint It, Black" uid: "amarok-sqltrackuid://mb-a8a591e2-6017-4c8c-91da-bf4bfa0e1bde" 
amarok:     [SqlRegistry] SqlRegistry::getDirectory new Directory "/home/syl/Music/Rolling Stones, The/[1966] Aftermath/" 
amarok:     [WARNING] [SqlCollectionLocation] Location is inserting a file with the same uid as an already existing one. 
amarok:     BEGIN: void OSDWidget::show(const QString&, QImage) 
amarok:     END__: void OSDWidget::show(const QString&, QImage) [Took: 0s] 
amarok:     BEGIN: void Context::ContextView::slotMetadataChanged(Meta::TrackPtr) 
amarok:       BEGIN: bool EngineController::isStream() 
amarok:       END__: bool EngineController::isStream() [Took: 0s] 
amarok:     END__: void Context::ContextView::slotMetadataChanged(Meta::TrackPtr) [Took: 0s] 
amarok:     [CurrentEngine] albums list unchanged, not updating 
amarok:     BEGIN: void LyricsAppletPrivate::_trackDataChanged(Meta::TrackPtr) 
amarok:     END__: void LyricsAppletPrivate::_trackDataChanged(Meta::TrackPtr) [Took: 0s] 
amarok:     BEGIN: virtual void Playlist::Model::metadataChanged(Meta::TrackPtr) 
amarok:       BEGIN: void StatusBar::updateTotalPlaylistLength() 
amarok:       END__: void StatusBar::updateTotalPlaylistLength() [Took: 0s] 
amarok:       [Playlist::Model] Metadata updated for track "Paint It, Black" 
amarok:     END__: virtual void Playlist::Model::metadataChanged(Meta::TrackPtr) [Took: 0.001s] 
amarok:     BEGIN: virtual void Dynamic::BiasedPlaylist::invalidate() 
amarok:     END__: virtual void Dynamic::BiasedPlaylist::invalidate() [Took: 0s] 
amarok:     BEGIN: void OSDWidget::show(const QString&, QImage) 
amarok:     END__: void OSDWidget::show(const QString&, QImage) [Took: 0s] 
amarok:     BEGIN: void Context::ContextView::slotMetadataChanged(Meta::TrackPtr) 
amarok:       BEGIN: bool EngineController::isStream() 
amarok:       END__: bool EngineController::isStream() [Took: 0s] 
amarok:     END__: void Context::ContextView::slotMetadataChanged(Meta::TrackPtr) [Took: 0s] 
amarok:     [CurrentEngine] albums list unchanged, not updating 
amarok:     BEGIN: void LyricsAppletPrivate::_trackDataChanged(Meta::TrackPtr) 
amarok:     END__: void LyricsAppletPrivate::_trackDataChanged(Meta::TrackPtr) [Took: 0s] 
amarok:     BEGIN: virtual void Playlist::Model::metadataChanged(Meta::TrackPtr) 
amarok:       BEGIN: void StatusBar::updateTotalPlaylistLength() 
amarok:       END__: void StatusBar::updateTotalPlaylistLength() [Took: 0s] 
amarok:       [Playlist::Model] Metadata updated for track "Paint It, Black" 
amarok:     END__: virtual void Playlist::Model::metadataChanged(Meta::TrackPtr) [Took: 0s] 
amarok:     BEGIN: virtual void Dynamic::BiasedPlaylist::invalidate() 
amarok:     END__: virtual void Dynamic::BiasedPlaylist::invalidate() [Took: 0s] 
amarok:     [SqlCollectionLocation] m_originalUrls QHash((true, KUrl("file:///home/syl/Music/Rolling Stones, The/[1966] Aftermath/01 - Rolling Stones, The - Paint It, Black.mp3") ) )  
amarok:     BEGIN: void Collections::CollectionLocation::slotFinishCopy() 
amarok:       BEGIN: void Collections::CollectionLocation::removeSourceTracks(const Meta::TrackList&) 
amarok:         [CollectionLocation] Transfer errors: 0 of 1 
amarok:         BEGIN: void Collections::CollectionLocation::prepareRemove(const Meta::TrackList&) 
amarok:           BEGIN: virtual bool Collections::SqlCollectionLocation::isWritable() const 
amarok:             [SqlCollectionLocation] "/home/syl/Download" 
amarok:             [SqlCollectionLocation]     used:  2.93388e+11 
amarok:             [SqlCollectionLocation]     total:  2.95854e+11 
amarok:             [SqlCollectionLocation]     free space:  2.46602e+09 
amarok:             [SqlCollectionLocation]     path_exists_writeable true 
amarok:             [SqlCollectionLocation]     path_exists_with_space true 
amarok:             [SqlCollectionLocation] "/home/syl/Music" 
amarok:             [SqlCollectionLocation]     used:  2.93388e+11 
amarok:             [SqlCollectionLocation]     total:  2.95854e+11 
amarok:             [SqlCollectionLocation]     free space:  2.46602e+09 
amarok:             [SqlCollectionLocation]     path_exists_writeable true 
amarok:             [SqlCollectionLocation]     path_exists_with_space true 
amarok:           END__: virtual bool Collections::SqlCollectionLocation::isWritable() const [Took: 0s] 
amarok:           BEGIN: void Collections::CollectionLocation::startRemoveWorkflow(const Meta::TrackList&) 
amarok:             BEGIN: virtual void Collections::CollectionLocation::showRemoveDialog(const Meta::TrackList&) 
amarok:               BEGIN: void Collections::CollectionLocation::slotStartRemove() 
amarok:                 BEGIN: virtual void Collections::SqlCollectionLocation::removeUrlsFromCollection(const Meta::TrackList&) 
amarok:                   [ScanManager] Abort scan:  "Scan blocked" 
amarok:                   BEGIN: bool Collections::SqlCollectionLocation::startNextRemoveJob() 
amarok:                     [SqlCollectionLocation] isGoingToRemoveSources()  true 
amarok:                     [SqlCollectionLocation] deleting   KUrl("file:///home/syl/Music/Rolling Stones, The/[1966] Aftermath/01 - Rolling Stones, The - Paint It, Black.mp3") 
amarok:                   END__: bool Collections::SqlCollectionLocation::startNextRemoveJob() [Took: 0s] 
amarok:                 END__: virtual void Collections::SqlCollectionLocation::removeUrlsFromCollection(const Meta::TrackList&) [Took: 0s] 
amarok:               END__: void Collections::CollectionLocation::slotStartRemove() [Took: 0s] 
amarok:             END__: virtual void Collections::CollectionLocation::showRemoveDialog(const Meta::TrackList&) [Took: 0s] 
amarok:           END__: void Collections::CollectionLocation::startRemoveWorkflow(const Meta::TrackList&) [Took: 0s] 
amarok:         END__: void Collections::CollectionLocation::prepareRemove(const Meta::TrackList&) [Took: 0.001s] 
amarok:       END__: void Collections::CollectionLocation::removeSourceTracks(const Meta::TrackList&) [Took: 0.001s] 
amarok:     END__: void Collections::CollectionLocation::slotFinishCopy() [Took: 0.001s] 
amarok:   END__: void Collections::SqlCollectionLocation::slotTransferJobFinished(KJob*) [Took: 0.21s]
Comment 34 Sergey Ivanov 2011-01-17 19:07:57 UTC
Your bug is particular case of this (https://bugs.kde.org/show_bug.cgi?id=263301) bug. File got deleted because of double slash '//' in destination path (/home/syl/Music/Rolling Stones, The/[1966]
Aftermath//01 - Rolling Stones, The - Paint It, Black.mp3 from debug log) It supposed to be fixed in current git master.
Comment 35 Silvian Cretu 2011-02-01 11:01:20 UTC
Indeed it's the double slash that's causing the file to be deleted. Waiting for 2.4.1...