Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2393 closed Bug (fixed)

Transmission deletes all files when moving to the same physical directory

Reported by: kvr Owned by: charles
Priority: Normal Milestone: 1.76
Component: libtransmission Version: 1.73
Severity: Major Keywords:
Cc:

Description

When moving data between two paths (symlinks) pointing to the same download directory, transmission removes all the data and starts from the beginning. I fixed the function setLocation to use the function rename preferably and in case all renames are successful, the deletion of old data and also unnecessary verification are skipped.

Attachments (1)

rename-patch.diff (2.1 KB) - added by kvr 12 years ago.
fix to setLocation

Download all attachments as: .zip

Change History (7)

Changed 12 years ago by kvr

fix to setLocation

comment:1 follow-up: Changed 12 years ago by charles

kvr: would it be better to change the implementation of tr_moveFile()?

comment:2 in reply to: ↑ 1 Changed 12 years ago by kvr

Replying to charles:

kvr: would it be better to change the implementation of tr_moveFile()?

Well, it also was my original idea, but in the end I decided for this solution. The reason is the tr_moveFile would need to return two success codes (renamed trivial, renamed with copy), which would be inconsistent with the old version and probably also with all of the other TR functions.

However, I can still modify it, the code would look like: tr_moveFile: if (rename(old, new) == 0)

return 1; /* trivial rename */

... return 0;

setLocation: The same as my new implementation, except tr_moveFile would be called directly: switch (tr_moveFile(...)) { case 0:

need_verify = 1; break;

case 1:

break;

default:

err = 1; break;

}

Let me know if you prefer this solution, I can prepare a patch for it.

comment:3 Changed 12 years ago by kvr

I'm sorry for formatting, but I hope the solution is clear anyway ;)

comment:4 Changed 12 years ago by charles

  • Keywords backport added; move operation removed
  • Milestone changed from None Set to 1.80
  • Status changed from new to assigned

comment:5 Changed 12 years ago by charles

  • Resolution set to fixed
  • Status changed from assigned to closed

fixed in trunk by r9251 for 1.80

comment:6 Changed 12 years ago by charles

  • Keywords backport removed
  • Milestone changed from 1.80 to 1.76

backported to the 1.7x branch for 1.7x in r9362

Note: See TracTickets for help on using tickets.