Bug 158534

Summary: extension stripped from filename
Product: [Fedora] Fedora Reporter: jeroen <jeroen>
Component: bittorrentAssignee: Paul Howarth <paul>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-05-24 10:57:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description jeroen 2005-05-23 12:50:22 UTC
When downloading a torrent
(http://www.mininova.org/get/45763/55.degrees.north.s02e01.ws.pdtv.xvid-river.%5BVTV%5D.torrent
for example), btdownloadmanycurses.py creates the video file without an AVI
extension. The should be named
55.degrees.north.s02e01.ws.pdtv.xvid-river.[VTV].avi, but it actually called
55.degrees.north.s02e01.ws.pdtv.xvid-river.[VTV].

Comment 1 Paul Howarth 2005-05-23 13:11:10 UTC
The problem appears to affect btdownloadmanycurses.py and btdownloadmany.py.

The problem does not appear to affect btdownloadcurses.py or btdownloadgui.py.

I've now reported the problem upstream; we'll see what the author has to say,

Comment 2 Paul Howarth 2005-05-23 21:08:54 UTC
Comments from upstream:

--------------------------------------------------------------------------

(I assume the person who reported this bug to you meant btlaunchmany*.py, as
there is no btdownloadmany*.py )

This is not a bug per se but rather possibly an issue with the default behavior
being wrong.

Checking the --help output, I see:

--saveas_style <arg>
          How to name torrent downloads (1 = rename to torrent name, 2 = save
          under name in torrent, 3 = save in directory under torrent name)
          (defaults to 1)

So the default behavior of btlaunchmany*.py is to save a torrent named

foo.bar.baz.torrent 

as

foo.bar.baz

even if the .torrent file says that the filename is 

foo.bar.baz.ext
or
foo.bar.ext

To get the behavior that you were expecting, you would have to add the
command line option --saveas_style 2, which would save

foo.bar.baz.torrent 

as

foo.bar.baz.ext (or whatever the .torrent file specifies)

I'm not sure which behavior is the best. Both --saveas_style #1 and #2 have
unexpected failure cases. #1 has this case you have noticed, and #2 has the case
where

foo.bar.baz.torrent

contains a file called:

one.two.ext

and when the user looks in the directory, there is no way for them to
know/remember that one.two.ext came from foo.bar.baz.torrent.

--saveas_style 3 seems a bad default because it would create a bunch
of vacuous directories, but it perhaps is the most secure and
error-free.

--------------------------------------------------------------------------

So I'm inclined to suggest that you use "--saveas_style 2" and close this one as
"not a bug". What do you think?


Comment 3 jeroen 2005-05-24 07:43:16 UTC
Right, btlaunchmanycurses.py. Only issue i have with this is the behavior
*changed* since 4.0 (i think). The default behavior used to be --saveas_style 2.

Additionally, after a torrent has finished, you have to rename the file to the
proper extension (PITA). One could argue that someone might not remember/know
what kind of filetype/mimetype the file he downloaded was. So i'd advocate
making --saveas_style 2 the default value.

Comment 4 Paul Howarth 2005-05-24 09:50:32 UTC
I don't think the change came in after 4.0.0; the defaultargs.py in 4.0.0 and
4.0.1 have the same default (1) for saveas_style.

I agree that the default doesn't seem very sensible (I'd personally advocate
style 3 as a better default) but that's what the upstream authors have chosen.
It's probably best to try arguing for a change upstream, as I'd rather keep the
RPM package reflecting upstream policy.

Are you OK with explictly using "--saveas_style 2" and now closing this bug?

Comment 5 jeroen 2005-05-24 10:12:44 UTC
Sure, thanks.

Comment 6 Paul Howarth 2005-06-02 15:33:44 UTC
FWIW, it's changed again in 4.1.x:

--saveas_style <arg>
          How to name torrent downloads: 1: use name OF torrent file (minus
          .torrent); 2: use name encoded IN torrent file; 3: create a directory
          with name OF torrent file (minus .torrent) and save in that directory
          using name encoded IN torrent file; 4: if name OF torrent file (minus
          .torrent) and name encoded IN torrent file are identical, use that
          name (style 1/2), otherwise create an intermediate directory as in
          style 3; CAUTION: options 1 and 2 have the ability to overwrite files
          without warning and may present security issues. (defaults to 4)