From owner-freebsd-ports@FreeBSD.ORG Fri Apr 22 19:25:31 2005 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BE19E16A4CE for ; Fri, 22 Apr 2005 19:25:31 +0000 (GMT) Received: from smtp817.mail.sc5.yahoo.com (smtp817.mail.sc5.yahoo.com [66.163.170.3]) by mx1.FreeBSD.org (Postfix) with SMTP id 62A6D43D54 for ; Fri, 22 Apr 2005 19:25:31 +0000 (GMT) (envelope-from noackjr@alumni.rice.edu) Received: from unknown (HELO optimator.noacks.org) (noacks@swbell.net@70.240.205.64 with login) by smtp817.mail.sc5.yahoo.com with SMTP; 22 Apr 2005 18:33:42 -0000 Received: from localhost (localhost [127.0.0.1]) by optimator.noacks.org (Postfix) with ESMTP id E96D161C8; Fri, 22 Apr 2005 13:33:41 -0500 (CDT) Received: from optimator.noacks.org ([127.0.0.1]) by localhost (optimator.noacks.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 66690-01; Fri, 22 Apr 2005 13:33:40 -0500 (CDT) Received: from [127.0.0.1] (optimator [192.168.1.11]) by optimator.noacks.org (Postfix) with ESMTP id 58FB26159; Fri, 22 Apr 2005 13:33:40 -0500 (CDT) Message-ID: <42694383.7090500@alumni.rice.edu> Date: Fri, 22 Apr 2005 13:33:39 -0500 From: Jon Noack User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Simon L. Nielsen" References: <42689D49.4050908@alumni.rice.edu> <20050422140619.GA785@zaphod.nitro.dk> In-Reply-To: <20050422140619.GA785@zaphod.nitro.dk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at noacks.org cc: ports@freebsd.org Subject: Re: portupgrade regression? X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: noackjr@alumni.rice.edu List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2005 19:25:31 -0000 On 4/22/2005 9:06 AM, Simon L. Nielsen wrote: > On 2005.04.22 01:44:25 -0500, Jon Noack wrote: >>Ever since the security fix for CAN-2005-0610, portupgrade and company >>have been behaving oddly for me. The root cause of this seems to be >>that the pkgdb is being updated needlessly with every operation: > > After the patch pkgdb.fixme is created in /var/db/pkg, which causes > the portupgrade package database update check to always fail. I get it now: portupgrade compares the /var/db/pkg timestamp to the pkgdb.db timestamp to figure out when to update. Creating pkgdb.fixme in /var/db/pkg will bump the /var/db/pkg timestamp and make it always seem like pkgdb.db is old and needs to be updating. >>Am I trying to do something that I shouldn't? What is the correct >>behavior here? > > It is definitely a bug that the package database is rebuild every > time, and portversion fails due to that problem. The solution is > probably to create pkgdb.fixme in another directory, but I haven't yet > found a secure and reliable fix. I am looking into it (and if anybody > has good ideas, or patches, please contact me). The following change (relative to the original source) leaves the default as the @db_dir but allows one to override it with PKG_TMPDIR or TMPDIR: ********************************************************************** --- pkgdb.rb.orig Mon Oct 18 09:59:09 2004 +++ pkgdb.rb Fri Apr 22 13:25:20 2005 @@ -96,7 +96,7 @@ @db_dir = File.expand_path(new_db_dir || ENV['PKG_DBDIR'] || '/var/db/pkg') @db_file = File.join(@db_dir, 'pkgdb.db') - @tmp_dir = ENV['PKG_TMPDIR'] || ENV['TMPDIR'] || '/var/tmp' + @tmp_dir = ENV['PKG_TMPDIR'] || ENV['TMPDIR'] || @db_dir @fixme_file = File.join(@tmp_dir, 'pkgdb.fixme') @db_filebase = @db_file.sub(/\.db$/, '') close_db ********************************************************************** One would need to apply the same change to pkgsqldb.rb. That change resolves the issue for me but preserves a secure default. Is that an acceptable compromise? Jon