<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>312001</bug_id>
          
          <creation_ts>2012-12-20 18:35:51 +0000</creation_ts>
          <short_desc>Amarok may skip files when copying into collection with some tracks already present and not overwriting</short_desc>
          <delta_ts>2012-12-22 21:03:44 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>amarok</product>
          <component>Collections/Local</component>
          <version>2.6.0</version>
          <rep_platform>Other</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.7</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Dmitry Torokhov">dmitry.torokhov</reporter>
          <assigned_to name="Amarok Bugs">amarok-bugs-null</assigned_to>
          <cc>matej</cc>
    
    <cc>ralf-engels</cc>
    
    <cc>rdieter</cc>
          
          <cf_commitlink>http://commits.kde.org/amarok/32c9f7ebf8ca7abf6d5397d9d74cadaa8c676ec2</cf_commitlink>
          <cf_versionfixedin>2.7</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1325190</commentid>
    <comment_count>0</comment_count>
    <who name="Dmitry Torokhov">dmitry.torokhov</who>
    <bug_when>2012-12-20 18:35:51 +0000</bug_when>
    <thetext>When selecting a tree of music files and selecting &quot;Copy to Collection&quot; - &quot;Local Collection&quot; from the context menu, and choosing copying tracks without overwriting already existing files, the transfer job will end prematurely if some tracks already exist at destination.



Reproducible: Always

Steps to Reproduce:
1. Import a directory
2. Remove several files that has just been imported from the local collection
3. Try importing the same directory again
Actual Results:  
Some of the deleted files will still be missing in the local collection.

Expected Results:  
Local collection should contain all tracks present in the original directory.

The TransferJob class in src/core-impl/collections/db/sql/SqlCollectionLocation.cpp is inherited from KCompositeJob; transfers are done via KIO::file_copy() and are registered as sub-jobs of TransferJob. The default policy of KCompositeJob is to terminate it early whenever a sub-job fails, so when copy job fails because file is already there we terminate the entire transfer instead of continuing.

One possible fix is overriding slotResult() method and handle (ignore) KIO::ERR_FILE_ALREADY_EXIST errors.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1325192</commentid>
    <comment_count>1</comment_count>
      <attachid>75943</attachid>
    <who name="Dmitry Torokhov">dmitry.torokhov</who>
    <bug_when>2012-12-20 18:40:51 +0000</bug_when>
    <thetext>Created attachment 75943
Patch to ignore ERR_FILE_ALREADY_EXIST when copying files

This patch allows me to copy missing files into local collection skipping ones that are already present and not stopping too early.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1325473</commentid>
    <comment_count>2</comment_count>
    <who name="Myriam Schweingruber">myriam</who>
    <bug_when>2012-12-21 15:42:44 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; Created attachment 75943 [details]
&gt; Patch to ignore ERR_FILE_ALREADY_EXIST when copying files
&gt; 
&gt; This patch allows me to copy missing files into local collection skipping
&gt; ones that are already present and not stopping too early.

Thank you for the patch, but please submit it to http://reviewboard.kde.org (you will need an identity on http://identity.kde.org for that).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1325547</commentid>
    <comment_count>3</comment_count>
    <who name="Dmitry Torokhov">dmitry.torokhov</who>
    <bug_when>2012-12-21 20:50:26 +0000</bug_when>
    <thetext>On Fri, Dec 21, 2012 at 03:42:44PM +0000, Myriam Schweingruber wrote:
&gt; https://bugs.kde.org/show_bug.cgi?id=312001
&gt; 
&gt; --- Comment #2 from Myriam Schweingruber &lt;myriam@kde.org&gt; ---
&gt; (In reply to comment #1)
&gt; &gt; Created attachment 75943 [details]
&gt; &gt; Patch to ignore ERR_FILE_ALREADY_EXIST when copying files
&gt; &gt; 
&gt; &gt; This patch allows me to copy missing files into local collection skipping
&gt; &gt; ones that are already present and not stopping too early.
&gt; 
&gt; Thank you for the patch, but please submit it to http://reviewboard.kde.org
&gt; (you will need an identity on http://identity.kde.org for that).

Really?? A maintainer can&apos;t simply evaluate patch and take it from there?
I do not really plan to start developing KDE at this time...

OK, I am a glutton for punishment, I have created a new identity and
tried uploading the patch. But this god awful reviewboard insists that
what I have is not really a patch (even though I tried feeding it both
unified and context version). Do I really need to have git tree to work
with reviewboard?

Why can&apos;t projects use sane venues to work with patches (AKA mailing
lists)? Bleh :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1325550</commentid>
    <comment_count>4</comment_count>
    <who name="Rex Dieter">rdieter</who>
    <bug_when>2012-12-21 21:03:43 +0000</bug_when>
    <thetext>I&apos;d be willing to help get this posted to reviewboard over the holidays, it does seem like an obvious improvement.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1325554</commentid>
    <comment_count>5</comment_count>
    <who name="Dmitry Torokhov">dmitry.torokhov</who>
    <bug_when>2012-12-21 21:23:04 +0000</bug_when>
    <thetext>On Fri, Dec 21, 2012 at 09:03:43PM +0000, Rex Dieter wrote:
&gt; https://bugs.kde.org/show_bug.cgi?id=312001
&gt; 
&gt; Rex Dieter &lt;rdieter@math.unl.edu&gt; changed:
&gt; 
&gt;            What    |Removed                     |Added
&gt; ----------------------------------------------------------------------------
&gt;              Status|UNCONFIRMED                 |CONFIRMED
&gt;      Ever confirmed|0                           |1
&gt; 
&gt; --- Comment #4 from Rex Dieter &lt;rdieter@math.unl.edu&gt; ---
&gt; I&apos;d be willing to help get this posted to reviewboard over the holidays, it
&gt; does seem like an obvious improvement.

Thanks Rex, I am just grumpy.

https://git.reviewboard.kde.org/r/107841/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1325620</commentid>
    <comment_count>6</comment_count>
    <who name="Myriam Schweingruber">myriam</who>
    <bug_when>2012-12-22 10:24:40 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; On Fri, Dec 21, 2012 at 03:42:44PM +0000, Myriam Schweingruber wrote:
&gt; &gt; https://bugs.kde.org/show_bug.cgi?id=312001
&gt; &gt; 
&gt; &gt; --- Comment #2 from Myriam Schweingruber &lt;myriam@kde.org&gt; ---
&gt; &gt; (In reply to comment #1)
&gt; &gt; &gt; Created attachment 75943 [details]
&gt; &gt; &gt; Patch to ignore ERR_FILE_ALREADY_EXIST when copying files
&gt; &gt; &gt; 
&gt; &gt; &gt; This patch allows me to copy missing files into local collection skipping
&gt; &gt; &gt; ones that are already present and not stopping too early.
&gt; &gt; 
&gt; &gt; Thank you for the patch, but please submit it to http://reviewboard.kde.org
&gt; &gt; (you will need an identity on http://identity.kde.org for that).
&gt; 
&gt; Really?? A maintainer can&apos;t simply evaluate patch and take it from there?
&gt; I do not really plan to start developing KDE at this time...
&gt; 
&gt; OK, I am a glutton for punishment, I have created a new identity and
&gt; tried uploading the patch. But this god awful reviewboard insists that
&gt; what I have is not really a patch (even though I tried feeding it both
&gt; unified and context version). Do I really need to have git tree to work
&gt; with reviewboard?
&gt; 
&gt; Why can&apos;t projects use sane venues to work with patches (AKA mailing
&gt; lists)? Bleh :(

Well, reviewboard expects you to just upload a diff, if you remove the text at the start of your patch file this should work. Add the comment to the description instead, or mark it as a comment in the patch body.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1325760</commentid>
    <comment_count>7</comment_count>
    <who name="Matěj Laitl">matej</who>
    <bug_when>2012-12-22 21:03:44 +0000</bug_when>
    <thetext>Git commit 32c9f7ebf8ca7abf6d5397d9d74cadaa8c676ec2 by Matěj Laitl, on behalf of Dmitry Torokhov.
Committed on 22/12/2012 at 20:15.
Pushed by laitl into branch &apos;master&apos;.

SqlCollectionLocation: do not stop transfer when some files are already at destination

This happens when you want to import a big tree of tracks at once and some
tracks are already present in the destination collection. In this case
TransferJob&apos;s copy subjob fails with KIO::ERR_FILE_ALEADY_EXIST and causes
entire transfer to complete prematurely.

BUGFIXES:
 * Fix existing files preventing complete transfer of tracks to collection
REVIEW: 107841
FIXED-IN: 2.7

M  +1    -0    ChangeLog
M  +10   -1    src/core-impl/collections/db/sql/SqlCollectionLocation.cpp
M  +1    -0    src/core-impl/collections/db/sql/SqlCollectionLocation.h

http://commits.kde.org/amarok/32c9f7ebf8ca7abf6d5397d9d74cadaa8c676ec2</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>75943</attachid>
            <date>2012-12-20 18:40:51 +0000</date>
            <delta_ts>2012-12-20 18:40:51 +0000</delta_ts>
            <desc>Patch to ignore ERR_FILE_ALREADY_EXIST when copying files</desc>
            <filename>amarok-skip-existing-files.patch</filename>
            <type>text/plain</type>
            <size>2137</size>
            <attacher name="Dmitry Torokhov">dmitry.torokhov</attacher>
            
              <data encoding="base64">QW1hcm9rOiB0byBub3Qgc3RvcCB0cmFuZWZlcnMgd2hlbiBzb21lIGZpbGVzIGFyZSBhbHJlYWR5
IGF0IGRlc3RpbmF0aW9uCgpUaGlzIGhhcHBlbnMgd2hlbiB5b3Ugd2FudCB0byBpbXBvcnQgYSBi
aXQgdHJlZSBvZiB0cmFja3MgYXQgb25jZSBhbmQgc29tZQp0cmFja3MgYXJlIGFscmVhZHkgcHJl
c2VudCBpbiB0aGUgZGVzdGluYXRpb24gY29sbGVjdGlvbi4KClNpZ25lZC1vZmYtYnk6IERtaXRy
eSBUb3Jva2hvdiA8ZG1pdHJ5LnRvcm9raG92QGdtYWlsLmNvbT4KLS0tCgpkaWZmIC1ydSBhbWFy
b2stMi42LjAtb3JpZy9zcmMvY29yZS1pbXBsL2NvbGxlY3Rpb25zL2RiL3NxbC9TcWxDb2xsZWN0
aW9uTG9jYXRpb24uY3BwIGFtYXJvay0yLjYu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