Bug 286219 - Default $HOME/Music folder is added as extra collection folder, if user does not enter KWallet password in time (Last.fm plugin enabled)
Summary: Default $HOME/Music folder is added as extra collection folder, if user does ...
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Collections/Local (show other bugs)
Version: 2.5.0
Platform: openSUSE Linux
: NOR major
Target Milestone: 2.6
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-09 21:09 UTC by Lassi Väätämöinen
Modified: 2012-06-15 07:47 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.6


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lassi Väätämöinen 2011-11-09 21:09:13 UTC
Version:           2.4.3 (using KDE 4.7.3) 
OS:                Linux

Music folder gets unwantedly added as collection folder, when "watch folders for changes" is enabled and user does not enter KWallet password during Amarok start-up. This can cause collection to be garbled in some cases. Hence, disabling last.fm plugin or folder watching fixes this.

Reproducible: Always

Steps to Reproduce:
1. Enable last.fm plugin and enter valid user credentials and save password to KWallet
2. Enable the "Watch folders for changes" option
3. Deselect $HOME/Music folder being as a collection folder.
4. Select some other folder containing music files to be included in collection
E.g. /mnt/mp3
5. Apply the configuration changes and wait for the current collection to be scanned. 
6. Quit Amarok (and possibly kill kwalletd process, if running)
7. Restart Amarok and and observe KWallet password dialog to appear
8. Wait, do not enter password


Actual Results:  
$HOME/Music folder gets added as collection folder and collection scan is done.

Expected Results:  
$HOME/Music folder should not be added as collection folder, as this is not something that user selected (see step 3.).

After the KWAllet dialog is shown the debug output in console stops. After a pause, the first thing that shows is the following:

BEGIN: void ScanManager::checkScannerVersion() 
amarok:             END__: void ScanManager::checkScannerVersion() [Took: 0.022s] 

Then the output pauses for some time again, and next thing that is shown:

amarok:             BEGIN: void ScanManager::checkForDirectoryChanges() 
amarok:               BEGIN: virtual void ScanManager::requestIncrementalScan(const QString&) 
amarok:                 [ScanManager] addDirToList for "" 
amarok:                 [WARNING] [ScanManager] Running scanner from Amarok while another Amarok instance is also running is dangerous. 
amarok:               END__: virtual void ScanManager::requestIncrementalScan(const QString&) [Took: 0.001s] 
amarok:               BEGIN: DirWatchJob::DirWatchJob(QObject*, Collections::DatabaseCollection*) 
amarok:                 BEGIN: virtual void ScannerJob::run()


After this a collection scan seems to be performed. Then, entering the KWallet password now, amarok starts up. Depending on the user's folder settings, e.g. having symlinks to /mnt/mp3 (see "to reproduce" step 4.) in $HOME/Music folder seems to have some effect in getting collection to show zero (or other invalid number of) tracks, thus needing to fully re-scan the collection (and remove check mark from $HOME/Music folder in collection settings).

Disabling "watch folders for changes" avoids this rescanning from happening
Comment 1 Johannes Wienke 2011-12-05 08:56:14 UTC
I am not sure if this is related, but for me from time to time $HOME itself becomes the collection folder instead of the $HOME-subfolder I usually use. This is really annoying, as it takes ages for the scanner to crawl through my home drive which slows down the whole computer.

I could not find out to which action (e.g. like the wallet mentioned above) this is related.
Comment 2 Lassi Väätämöinen 2012-01-21 09:09:59 UTC
Note that the last.fm plugin needs to be enabled.

Also, there seems to be another problem. When wallet is not open yet (no other app is using wallet), and Amarok is started, the wallet is closed immediately after giving the KWallet password that last.fm plugin needs. 

So there is erroneus KWallet handling in the last.fm plugin in general. However, to me it seems Amarok should not proceed in collection scan anyways.
Comment 3 Lassi Väätämöinen 2012-01-21 09:11:28 UTC
(In reply to comment #2)
> the wallet is closed immediately
> after giving the KWallet password that last.fm plugin needs. 

And KWallet is in "close when last application stops using it"-mode. Kopete handles this correctly.
Comment 4 Myriam Schweingruber 2012-01-21 19:07:35 UTC
Confirmed by duplicates. Could you please upgrade to Amarok 2.5.0 and try again?
Comment 5 Lassi Väätämöinen 2012-01-22 10:16:18 UTC
(In reply to comment #4)
> Confirmed by duplicates. Could you please upgrade to Amarok 2.5.0 and try
> again?

Reproducable on 2.5.0 also.
Comment 6 Myriam Schweingruber 2012-01-24 07:33:30 UTC
Thank you for the fast feedback. Setting to confirmed as it was also reported in the forum.
Comment 7 Edward Hades 2012-06-14 12:21:51 UTC
Git commit 81c9d4d1bd1fa58ab0b89588d3a860e82e9b3d3e by Edward Hades.
Committed on 13/06/2012 at 22:38.
Pushed by hades into branch 'master'.

Do not return collectionFolders() unless ready.

If a collectionFolders() method of MountPointManager is called before it
has completed identifying mount points, it adds the default path like
$HOME/Music.

M  +8    -0    src/MountPointManager.cpp
M  +1    -0    src/MountPointManager.h

http://commits.kde.org/amarok/81c9d4d1bd1fa58ab0b89588d3a860e82e9b3d3e