What should happen if the destination file exists?

Bug #1228254 reported by Barry Warsaw
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-download-manager
Fix Released
Critical
Manuel de la Peña
ubuntu-download-manager (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Let's say I ask the download service to download to /tmp/foo.tgz and this succeeds.

Now I ask again for it to download to /tmp/foo.tgz. What should happen?

Currently, u-d-m appends the new downloaded data to the existing file, but that's definitely not right since the hashes will be broken.

A few options, but I'm not sure what's best:

1) Truncate the original file and overwrite it.
2) Throw a DBus exception (e.g. the moral equivalent of EEXIST)
3) Append a .1 to the file name.

I'm currently leaning toward #2.

Related branches

Changed in ubuntu-download-manager:
status: New → Triaged
importance: Undecided → Critical
assignee: nobody → Manuel de la Peña (mandel)
Revision history for this message
Manuel de la Peña (mandel) wrote :

I'm leaning to the following implementation:

If the local-path is provided and we are not a confined application:
  2) Throw a DBus exception (e.g. the moral equivalent of EEXIST)
if not confined:
 3) Append a .1 to the file name. (although I'm appending a uuid to make sure we do not have an extra loop)

Changed in ubuntu-download-manager:
status: Triaged → In Progress
Revision history for this message
Barry Warsaw (barry) wrote : Re: [Bug 1228254] Re: What should happen if the destination file exists?

On Sep 25, 2013, at 11:59 AM, Manuel de la Peña wrote:

>I'm leaning to the following implementation:
>
>If the local-path is provided and we are not a confined application:
> 2) Throw a DBus exception (e.g. the moral equivalent of EEXIST)
>if not confined:
> 3) Append a .1 to the file name. (although I'm appending a uuid to make sure we do not have an extra loop)

I'm a bit confused. Do you mean if you *are* confined you'll do #3? I think
for an unconfined app (e.g. system-image), the exception would be best. I
won't be expecting a file name with .<uuid> and wouldn't be looking for it.
(OTOH, I would never expect that the destination file would exist - that would
be a bug in my code.)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:ubuntu-download-manager at revision 146, scheduled for release in ubuntu-download-manager, milestone 0.3

Changed in ubuntu-download-manager:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-download-manager - 0.2+13.10.20130930-0ubuntu1

---------------
ubuntu-download-manager (0.2+13.10.20130930-0ubuntu1) saucy; urgency=low

  [ Manuel de la Pena ]
  * Deal with the presence of the download file in a nicer way. (LP:
    #1228254)

  [ Ubuntu daily release ]
  * Automatic snapshot from revision 146
 -- Ubuntu daily release <email address hidden> Mon, 30 Sep 2013 14:28:20 +0000

Changed in ubuntu-download-manager (Ubuntu):
status: New → Fix Released
Changed in ubuntu-download-manager:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.