From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Aug 22 10:30:02 2007 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8724016A421 for ; Wed, 22 Aug 2007 10:30:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 695D413C483 for ; Wed, 22 Aug 2007 10:30:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l7MAU2dj068840 for ; Wed, 22 Aug 2007 10:30:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l7MAU2BY068839; Wed, 22 Aug 2007 10:30:02 GMT (envelope-from gnats) Resent-Date: Wed, 22 Aug 2007 10:30:02 GMT Resent-Message-Id: <200708221030.l7MAU2BY068839@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alex Samorukov Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24B3916A41A; Wed, 22 Aug 2007 10:27:40 +0000 (UTC) (envelope-from root@ukrlex.net) Received: from ukrlex.net (shevdid.com [213.186.192.166]) by mx1.freebsd.org (Postfix) with ESMTP id ADB0613C48E; Wed, 22 Aug 2007 10:27:39 +0000 (UTC) (envelope-from root@ukrlex.net) Received: from root by ukrlex.net with local (Exim 4.67 (FreeBSD)) (envelope-from ) id 1INn8x-0008pN-UE; Wed, 22 Aug 2007 13:08:55 +0300 Message-Id: Date: Wed, 22 Aug 2007 13:08:55 +0300 From: Alex Samorukov To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: sergei@FreeBSD.org Subject: ports/115709: [PATCH] mail/archivemail: [Fix problems with python 2.5] X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Aug 2007 10:30:02 -0000 >Number: 115709 >Category: ports >Synopsis: [PATCH] mail/archivemail: [Fix problems with python 2.5] >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Aug 22 10:30:01 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Alex Samorukov >Release: FreeBSD 6.1-RELEASE-p19 i386 >Organization: >Environment: System: FreeBSD ukrlex.net 6.1-RELEASE-p19 FreeBSD 6.1-RELEASE-p19 #7: Mon Aug 13 11:03:22 EEST 2007 >Description: When running with python 2.5 archivemail fail with error. Error is already fixed by upstream, patch is taken from http://sourceforge.net/tracker/index.php?func=detail&aid=1670422&group_id=49630&atid=456910 Here is a description from sf.net tracker: .maildir/local is a Maildir and message is a rfc822.Message instance. In python2.4 message.fp.name gives the path of the file where this message is stored. In python2.5 this doesn't exist but same info is avaliable from 'message.fp._file.name' I've written a patch for archivemail-0.7.0 to check for python version and decide whether to use message.fp.name or message.fp._file.name and the tool seems to work fine. Added file(s): - files/patch-archivemail Port maintainer (sergei@FreeBSD.org) is cc'd. Generated with FreeBSD Port Tools 0.77 >How-To-Repeat: Update python to 2.5 version. Run the script. You will got ... AttributeError: _ProxyFile instance has no attribute 'name' error. >Fix: --- archivemail-0.7.0.patch begins here --- diff -ruN --exclude=CVS /usr/ports/mail/archivemail/files/patch-archivemail /usr/home/samorukov/src/archivemail/files/patch-archivemail --- /usr/ports/mail/archivemail/files/patch-archivemail Thu Jan 1 03:00:00 1970 +++ /usr/home/samorukov/src/archivemail/files/patch-archivemail Wed Aug 22 13:01:51 2007 @@ -0,0 +1,94 @@ +--- archivemail.orig 2006-11-03 01:21:22.000000000 +0200 ++++ archivemail 2007-05-10 12:04:16.000000000 +0300 +@@ -779,7 +779,10 @@ + # the headers have no valid dates -- last resort, try the file timestamp + # this will not work for mbox mailboxes + try: +- file_name = message.fp.name ++ if sys.hexversion >= 0x020500F0: ++ file_name = message.fp._file.name ++ else: ++ file_name = message.fp.name + except AttributeError: + # we are looking at a 'mbox' mailbox - argh! + # Just return the current time - this will never get archived :( +@@ -788,7 +791,7 @@ + if not os.path.isfile(file_name): + unexpected_error("mailbox file name '%s' has gone missing" % \ + file_name) +- time_message = os.path.getmtime(message.fp.name) ++ time_message = os.path.getmtime(file_name) + vprint("using valid time found from '%s' last-modification time" % \ + file_name) + return time_message +@@ -806,7 +809,11 @@ + """ + status = "" + x_status = "" +- match = re.search(":2,(.+)$", message.fp.name) ++ if sys.hexversion >= 0x020500F0: ++ fpname = message.fp._file.name ++ else: ++ fpname = message.fp.name ++ match = re.search(":2,(.+)$", fpname) + if match: + flags = match.group(1) + for flag in flags: +@@ -825,7 +832,7 @@ + + # files in the maildir 'cur' directory are no longer new, + # they are the same as messages with 'Status: O' headers in mbox +- last_dir = os.path.basename(os.path.dirname(message.fp.name)) ++ last_dir = os.path.basename(os.path.dirname(fpname)) + if last_dir == "cur": + status = status + "O" + +@@ -881,7 +888,10 @@ + return 1 + file_name = None + try: +- file_name = message.fp.name ++ if sys.hexversion >= 0x020500F0: ++ file_name = message.fp._file.name ++ else: ++ file_name = message.fp.name + except AttributeError: + pass + # maildir mailboxes use the filename suffix to indicate flagged status +@@ -901,7 +911,10 @@ + return 0 + file_name = None + try: +- file_name = message.fp.name ++ if sys.hexversion >= 0x020500F0: ++ file_name = message.fp._file.name ++ else: ++ file_name = message.fp.name + except AttributeError: + pass + # maildir mailboxes use the filename suffix to indicate read status +@@ -918,7 +931,10 @@ + file_name = None + message_size = None + try: +- file_name = message.fp.name ++ if sys.hexversion >= 0x020500F0: ++ file_name = message.fp._file.name ++ else: ++ file_name = message.fp.name + except AttributeError: + pass + if file_name: +@@ -1269,7 +1285,11 @@ + if type == "maildir": + add_status_headers(msg) + archive.write(msg) +- if not options.dry_run: delete_queue.append(msg.fp.name) ++ if sys.hexversion >= 0x020500F0: ++ fpname = msg.fp._file.name ++ else: ++ fpname = msg.fp.name ++ if not options.dry_run: delete_queue.append(fpname) + else: + vprint("decision: retain message") + msg = original.next() --- archivemail-0.7.0.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: