After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 504492 - Using auto-sync on a device can delete lots of data without asking/warning the user
Using auto-sync on a device can delete lots of data without asking/warning th...
Status: RESOLVED FIXED
Product: banshee
Classification: Other
Component: Device - iPod
git master
Other All
: Normal normal
: 2.x
Assigned To: Banshee Maintainers
Banshee Maintainers
: 598953 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-12-19 16:15 UTC by Raimo Tuisku
Modified: 2010-03-04 23:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
hal-device output when android phone is connected (139.99 KB, application/octet-stream)
2010-02-07 21:50 UTC, Timo Derstappen
  Details
hal-device output when usb disc is connected (140.32 KB, application/octet-stream)
2010-02-07 21:51 UTC, Timo Derstappen
  Details
Proposed patch, v1 (3.55 KB, patch)
2010-02-15 13:02 UTC, Andrés G. Aragoneses (IRC: knocte)
needs-work Details | Review
Patch v2 (4.07 KB, patch)
2010-03-04 12:13 UTC, Andrés G. Aragoneses (IRC: knocte)
committed Details | Review

Description Raimo Tuisku 2007-12-19 16:15:30 UTC
When pressing "Synchronize iPod" on the upper right when iPod is connected and the media library has only one item, expected result is NOT removing all files in the iPod but ASK whether they should be removed or not.

In my case all my songs synchronized from another machine were lost thanks to Banshee.

Other information:
Comment 1 Andrés G. Aragoneses (IRC: knocte) 2009-03-12 00:43:16 UTC
I'd like to work on this bug. Let's discuss what would be the best expected result. What I was thinking is something like:

The synchronization operation to this device will cause the removal of X items and the addition of Y items. Do you want to continue?

Opinions?
Comment 2 John Millikin 2009-03-28 18:03:46 UTC
If a warning box pops up every time, the user will just ignore it and click "OK". Better to have the box pop up only if there's a good chance the user's about to lose something they care about.

For example, when more than 10 songs will be deleted. I assume removing an album's worth of tracks will be an unusual enough action that the window popping up will be noticed. It could be something like this:

                                WARNING
 / \   This will remove {number} of tracks from your iPod. Are you sure
/ ! \  you want to continue?
-----                                     [Cancel] [Remove Tracks]
Comment 3 Michael Martin-Smucker 2009-10-19 16:33:02 UTC
*** Bug 598953 has been marked as a duplicate of this bug. ***
Comment 4 Michael Martin-Smucker 2009-10-19 16:45:07 UTC
I confirmed this because of the duplicate, and I updated the version to git, as this can still happen with the latest Banshee.  I also changed the title to reflect that this is a potential issue for all audio players, not just iPods.  It would also seem appropriate to change the "Component," but I can't find any that seem appropriate.  Is there a generic DAP component that I'm missing?

Also, because this has the potential to destroy a lot of data, I think the severity should be "Normal" at the least.

Also I agree with John's idea about only showing the warning when some "significant" number of songs will be deleted.  And it's definitely a good idea to have the confirmation button read "Remove Tracks" so that users don't just click through without reading it.
Comment 5 Andrés G. Aragoneses (IRC: knocte) 2009-10-19 17:08:01 UTC
(In reply to comment #4)
> I also changed the title to
> reflect that this is a potential issue for all audio players, not just iPods.

I'm changing it to replace Synchronization by "auto-sync", as this cannot happen with manual sync.

> Also, because this has the potential to destroy a lot of data, I think the
> severity should be "Normal" at the least.

Agreed.

> Also I agree with John's idea about only showing the warning when some
> "significant" number of songs will be deleted.  And it's definitely a good idea
> to have the confirmation button read "Remove Tracks" so that users don't just
> click through without reading it.

Good idea.

Apologies because I said I would work on this but for now I didn't have time. Let's see in the upcoming weekends...
Comment 6 Timo Derstappen 2010-02-07 21:00:51 UTC
This issue resulted in an even worse scenario:

I auto-synced my android phone with a playlist - ejected the phone and mounted an external hard drive. Both devices were attached as /dev/sdd. 

Banshee started to auto-sync with the external hard disc removing all files in /Music from that disk.

I'm using Ubuntu with the ppa from launchpad. Version: 1.5.4~really1.5.3-0ubuntu1~hyper1~karmic
Comment 7 Gabriel Burt 2010-02-07 21:04:55 UTC
Timo: I'm trying to understand how that could happen.  Are you mounting/unmounting/ejecting things by hand on the command line?  Can you attach the output of hal-device with your DAP plugged in/mounted and with your external drive mounted?
Comment 8 Timo Derstappen 2010-02-07 21:49:16 UTC
I've umounted the android phone via nautilus. Both devices were mounted via auto mount. I didn't have a look at what banshee was doing, cause if copied some other files on the phone.
Comment 9 Timo Derstappen 2010-02-07 21:50:35 UTC
Created attachment 153232 [details]
hal-device output when android phone is connected
Comment 10 Timo Derstappen 2010-02-07 21:51:17 UTC
Created attachment 153233 [details]
hal-device output when usb disc is connected
Comment 11 Andrés G. Aragoneses (IRC: knocte) 2010-02-15 13:02:37 UTC
Created attachment 153820 [details] [review]
Proposed patch, v1

This is the first proposal of a patch. I have tested it and it seems to work.

Hopefully we can get less annoyed users by this.
Comment 12 Alexander Kojevnikov 2010-03-04 09:17:09 UTC
Review of attachment 153820 [details] [review]:

A few minor nitpicks, otherwise looks good!

::: src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs
@@ +200,3 @@
+
+        }
+            Sync (false);

May be rename `allowed` to `force`, it will make its purpose a bit more clear.

@@ +256,3 @@
             Catalog.GetString ("{0} to add, {1} to remove, {2} to update");
+        internal class PossibleUserErrorException : OperationCanceledException {
+

AFAIK we are supposed to derive all custom exceptions from ApplicationException.

::: src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs
@@ +362,3 @@
+                } catch (DapLibrarySync.PossibleUserErrorException e) {
+                    library_sync.Sync ();
+                try {

You still need to use GetPluralString(), some languages have multiple plural forms, e.g. Russian and Polish have different forms for 21, 22-24 and 25-30 items:

http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
Comment 13 Andrés G. Aragoneses (IRC: knocte) 2010-03-04 12:13:49 UTC
Created attachment 155221 [details] [review]
Patch v2

(In reply to comment #12)
> Review of attachment 153820 [details] [review]:
> 
> A few minor nitpicks, otherwise looks good!

Thanks for the review!

> ::: src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs
> @@ +200,3 @@
> +
> +        }
> +            Sync (false);
> 
> May be rename `allowed` to `force`, it will make its purpose a bit more clear.

Ok, done.

> @@ +256,3 @@
>              Catalog.GetString ("{0} to add, {1} to remove, {2} to update");
> +        internal class PossibleUserErrorException : OperationCanceledException
> {
> +
> 
> AFAIK we are supposed to derive all custom exceptions from
> ApplicationException.

Mmmm, seems right because MSDN says[1]:
"User applications, not the common language runtime, throw custom exceptions derived from the ApplicationException class. The ApplicationException class differentiates between exceptions defined by applications versus exceptions defined by the system."

However I liked the fact that it inherited from the meaningful "OperationCanceledException" rather than the plain "ApplicationException" and MSDN also says[1]:
"If you are designing an application that needs to create its own exceptions, you are advised to derive custom exceptions from the Exception class. It was originally thought that custom exceptions should derive from the ApplicationException class; however in practice this has not been found to add significant value."

BUT, I found that it seems all banshee's exceptions follow this rule (even for PlaylistImportCanceledException), so I followed the current convention.

[1] http://msdn.microsoft.com/en-us/library/system.applicationexception.aspx

> ::: src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs
> @@ +362,3 @@
> +                } catch (DapLibrarySync.PossibleUserErrorException e) {
> +                    library_sync.Sync ();
> +                try {
> 
> You still need to use GetPluralString(), some languages have multiple plural
> forms, e.g. Russian and Polish have different forms for 21, 22-24 and 25-30
> items:
> 
> http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms

Wow, didn't know about this. I bet then that there are a lot of places where we should use it and we're not using it. The downside of this is that the N=1 form will be unused though.
Comment 14 Alexander Kojevnikov 2010-03-04 23:05:35 UTC
Committed, thanks Andrés!