From owner-freebsd-ports@FreeBSD.ORG Mon Mar 19 23:04:07 2007 Return-Path: X-Original-To: ports@freebsd.org Delivered-To: freebsd-ports@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CEFC316A402 for ; Mon, 19 Mar 2007 23:04:07 +0000 (UTC) (envelope-from parv@pair.com) Received: from mta11.adelphia.net (mta11.adelphia.net [68.168.78.205]) by mx1.freebsd.org (Postfix) with ESMTP id 7BB0E13C4AE for ; Mon, 19 Mar 2007 23:04:07 +0000 (UTC) (envelope-from parv@pair.com) Received: from default.chvlva.adelphia.net ([24.126.17.68]) by mta11.adelphia.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20070319230406.ULYH2195.mta11.adelphia.net@default.chvlva.adelphia.net>; Mon, 19 Mar 2007 19:04:06 -0400 Received: by default.chvlva.adelphia.net (Postfix, from userid 1000) id 4CF37B7E8; Mon, 19 Mar 2007 19:04:04 -0400 (EDT) Date: Mon, 19 Mar 2007 19:04:04 -0400 From: Parv To: Joe Marcus Clarke Message-ID: <20070319230404.GA3166@holestein.holy.cow> Mail-Followup-To: Joe Marcus Clarke , ports@freebsd.org, sem@freebsd.org References: <1174330341.26866.32.camel@shumai.marcuscom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1174330341.26866.32.camel@shumai.marcuscom.com> Cc: ports@freebsd.org, sem@freebsd.org Subject: Re: Problems running pkgdb -fF X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2007 23:04:07 -0000 in message <1174330341.26866.32.camel@shumai.marcuscom.com>, wrote Joe Marcus Clarke thusly... > > Running pkgdb -Ff today gives me the following error: > > Stale origin: 'multimedia/totem-gstreamer': perhaps moved or obsoleted. > -> The port 'multimedia/totem-gstreamer' was moved to 'multimedia/totem' on 2007-03-19 because: > "multimedia/totem now uses gstreamer by default" > sed: 1: "s|^\(@comment[": unbalanced brackets ([]) > Failed to rewrite /var/db/pkg/totem-gstreamer-2.16.5/+CONTENTS: Command failed [exit code 1]: "sed" "\"s|^\\\\(@comment[\"" "\"\"" "\"][\"" "\"\"" "\"]*ORIGIN:\\\\).*\\\$|\\\\1multimedia/totem|\"" "<" "/var/db/pkg/totem-gstreamer-2.16.5/+CONTENTS" ">" "/tmp/+CONTENTS.71426.0" > > This is with portupgrade 2.2.6_2,2 on both 6-STABLE i386 and > 7-CURRENT amd64. I don't think I did anything funky with the > totem MOVED entry. This seems to be a problem with pkgdb. Looks like sed command gets broken on unescaped|uncared-for otherwise important space character. The command is being made in modify_origin() in pkgtools.rb ... 792 if grep_q_file(/^@comment[ \t]+ORIGIN:/, contents_file) 793 command = shelljoin('sed', 794 "s|^\\(@comment[ \t][ \t]*ORIGIN:\\).*$|\\1#{origin}|") 795 else 796 command = "(cat; echo '@comment ORIGIN:#{origin}')" 797 end 798 799 filter_file(command, contents_file) ... which is being executed in filter_file() ... 838 xsystem("#{command} < #{file} > #{tmpfile}") Here is minimized case which causes above problem ... # for shelljoin() require "pkgmisc" origin = 'some/where' file = '/tmp/in-file' tmpfile = '/tmp/out-file' cmd = shelljoin('sed', "s|^\\(@comment[ \t][ \t]*ORIGIN:\\).*$|\\1#{origin}|") system("#{cmd} < #{file} > #{tmpfile}") Perhaps another version of shelljoin() is needed specifically tuned for sed. I myself would do the substitution in Ruby itself, or failing that in Perl or awk. - Parv --