Page 1 of 2

Deluge overwrites files when downloading with same name.

Posted: Fri Oct 17, 2008 7:16 am
by sad panda
Okay I had a torrent with a folder named something.7z
inside this folder was a 7zip file named something.7z

(same exact name)

I though there was an error in my torrent so I moved the 7zip file back into the torrents folder and re-initialized the .torrent file.
Deluge promptly overwrote the something.7z file with junk data from the torrent.

I think deluge should be checking before it happily overwrites a file thinking that file is a folder, before throwing an Error.

Re: Deluge overwrites files when downloading with same name.

Posted: Fri Oct 17, 2008 11:11 pm
by loki
I could not repeat such an error...

Re: Deluge overwrites files when downloading with same name.

Posted: Fri Oct 17, 2008 11:58 pm
by sad panda
I removed the torrent from deluge before adding it back in again. Did you do that?

Re: Deluge overwrites files when downloading with same name.

Posted: Sat Oct 18, 2008 12:26 am
by loki
Yes, it re-checked it and continued seeding.
The only thing I can think is the file wasn't the same as when the torrent file was created so it marked the data as corrupt and started downloading the proper data for the torrent.

Re: Deluge overwrites files when downloading with same name.

Posted: Sat Oct 18, 2008 4:25 am
by sad panda
loki wrote:The only thing I can think is the file wasn't the same as when the torrent file was created so it marked the data as corrupt and started downloading the proper data for the torrent.
No. Deluge expected to place a FOLDER in the torrents folder. Instead there was a FILE of the same name as the FOLDER deluge wanted to save. Thus, the error.

Re: Deluge overwrites files when downloading with same name.

Posted: Sat Oct 18, 2008 4:50 am
by johnnyg
So from the sounds of it, you had a completed file located at:
<download directory>/file.7z/file.7z
you then removed that file from deluge and re-added it, specifying <download directory>/file.7z/ to be the download directory.
deluge saw the file.7z (actual file) and thought it was the file.7z folder, so it did a hash check (which would have failed) and then started downloading it from scratch.

is this correct?

Re: Deluge overwrites files when downloading with same name.

Posted: Sat Oct 18, 2008 8:27 pm
by sad panda
johnnyg wrote:So from the sounds of it, you had a completed file located at:
<download directory>/file.7z/file.7z
you then removed that file from deluge and re-added it, specifying <download directory>/file.7z/ to be the download directory.
deluge saw the file.7z (actual file) and thought it was the file.7z folder, so it did a hash check (which would have failed) and then started downloading it from scratch.

is this correct?
something like that. After it started "downloading from scratch" it had an error because it tried to save the file.7z inside of the <download directory>/file.7z/ directory folder, which of course it could not do, because <download directory>/file.7z was actually a FILE not a folder.

Re: Deluge overwrites files when downloading with same name.

Posted: Sun Oct 19, 2008 5:26 am
by loki
Ah, I think I see what you mean...
I think this would be a limitation of the file system, for me anyway, it doesn't differentiate a folder from a file... try to take any old file and create a new folder in that directory with the same name and extension... it will say it already exists.
And if you didn't create the torrent with the folder included it would have overwritten the file with the folder... hope that makes sense.

Re: Deluge overwrites files when downloading with same name.

Posted: Sun Oct 19, 2008 4:48 pm
by sad panda
loki wrote: it doesn't differentiate a folder from a file.
Python has a simple test to differentiate a folder from a file: stat.S_ISDIR(os.stat(file).st_mode)

Re: Deluge overwrites files when downloading with same name.

Posted: Sun Oct 19, 2008 8:02 pm
by loki
But even if it did differentiate between a file and a folder it would have to overwrite it in order to save it is a file, not a folder.