Subject: pkg/29023: net/bittorrent multiple lossage: w/o terminal, making torrents
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <gdt@ir.bbn.com>
List: pkgsrc-bugs
Date: 01/20/2005 13:18:01
>Number:         29023
>Category:       pkg
>Synopsis:       net/bittorrent multiple lossage: w/o terminal, making torrents
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 20 13:18:00 +0000 2005
>Originator:     Greg Troxel
>Release:        NetBSD 2.0_RC4
>Organization:
        Greg Troxel <gdt@ir.bbn.com>
>Environment:
	
	
System: NetBSD fnord.ir.bbn.com 2.0_RC4 NetBSD 2.0_RC4 (SINEW) #44: Mon Jan 10 19:54:05 EST 2005 root@call-cc.ir.bbn.com:/n0/obj/sinew/gdt/i386/sys/arch/i386/compile/SINEW i386
Architecture: i386
Machine: i386
>Description:
pkgsrc/net/bittorrent has two unrelated problems:

  btdownheadless.py initializes curses to find the terminal width in
  a misguided attempt to wrap output lines to the 'right' value.
  While this is in a 'try:' block, the process exits due to the
  initscr() call.   [This is misguided because the normal thing to do
  is to put stdout onto a file for looking at later, and there's no
  reason to expect the same line length.  80 columns is obviously the
  right answer.]

  btcompletedir.py fails if you don't specify a piece size on the
  command line.  AFAICT, it should default to something reasonable.

>How-To-Repeat:

  start up btdownheadless.py from /etc/rc.local or some such, with no
  controlling terminal  (just having stdin/stdout/stderr to files is
  not sufficient)

  Run btcompletedir.py with just a tracker  URL as first arg and a
  directory as second arg.

>Fix:

  Don't try curses at all.

  Force piece size to 2^17.

Apply to pkgsrc (I did these sequentially, so PKGREVISION=2 is not
here).

Index: Makefile
===================================================================
RCS file: /NETBSD-CVS/pkgsrc/net/bittorrent/Makefile,v
retrieving revision 1.23
diff -u -r1.23 Makefile
--- Makefile	3 Oct 2004 00:17:49 -0000	1.23
+++ Makefile	20 Jan 2005 12:55:59 -0000
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.22 2004/04/27 03:43:54 snj Exp $
+# $NetBSD: Makefile,v 1.23 2004/10/03 00:17:49 tv Exp $
 #
 
 .include "Makefile.common"
 
 PKGNAME=	${DISTNAME:S/BitT/bitt/}
-PKGREVISION=	1
+PKGREVISION=	3
 
 PYDISTUTILSPKG=	YES
 
Index: distinfo
===================================================================
RCS file: /NETBSD-CVS/pkgsrc/net/bittorrent/distinfo,v
retrieving revision 1.11
diff -u -r1.11 distinfo
--- distinfo	25 May 2004 12:42:19 -0000	1.11
+++ distinfo	20 Jan 2005 12:55:59 -0000
@@ -1,6 +1,8 @@
-$NetBSD: distinfo,v 1.10 2004/03/29 23:39:43 wiz Exp $
+$NetBSD: distinfo,v 1.11 2004/05/25 12:42:19 wiz Exp $
 
 SHA1 (BitTorrent-3.4.2.zip) = e3c34b0988369e706564f24fc63d9921c6af8298
 Size (BitTorrent-3.4.2.zip) = 244989 bytes
 SHA1 (patch-aa) = 8c3abb81127bda1594b944fd6e11f587e8477e87
 SHA1 (patch-ab) = 186ad86d153bc0c7a3e3234c03ec854b2325cb03
+SHA1 (patch-ac) = 458e7157bd89200ef5a7e6d8de7702220252fc5a
+SHA1 (patch-ad) = 4b6d5e4e1b2b3e5c1bf68112641577a5c5ccee90
Index: patches/patch-ac
===================================================================
RCS file: patches/patch-ac
diff -N patches/patch-ac
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-ac	20 Jan 2005 12:55:59 -0000
@@ -0,0 +1,19 @@
+$NetBSD$
+
+--- btdownloadheadless.py.orig	2003-09-21 10:58:45.000000000 -0400
++++ btdownloadheadless.py
+@@ -146,13 +146,7 @@ def print_spew(spew):
+     print s.getvalue()
+ 
+ def run(params):
+-    try:
+-        import curses
+-        curses.initscr()
+-        cols = curses.COLS
+-        curses.endwin()
+-    except:
+-        cols = 80
++    cols = 80
+ 
+     h = HeadlessDisplayer()
+     download(params, h.chooseFile, h.display, h.finished, h.error, Event(), cols, h.newpath)
Index: patches/patch-ad
===================================================================
RCS file: patches/patch-ad
diff -N patches/patch-ad
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-ad	20 Jan 2005 12:55:59 -0000
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- btcompletedir.py.orig	2004-03-03 12:44:28.000000000 -0500
++++ btcompletedir.py
+@@ -12,7 +12,7 @@ from btmakemetafile import calcsize, mak
+ def dummy(x):
+     pass
+ 
+-def completedir(files, url, flag = Event(), vc = dummy, fc = dummy, piece_len_pow2 = None):
++def completedir(files, url, flag = Event(), vc = dummy, fc = dummy, piece_len_pow2 = 17):
+     files.sort()
+     ext = '.torrent'
+ 

>Unformatted: