Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Mar 2007 19:04:04 -0400
From:      Parv <parv@pair.com>
To:        Joe Marcus Clarke <marcus@marcuscom.com>
Cc:        ports@freebsd.org, sem@freebsd.org
Subject:   Re: Problems running pkgdb -fF
Message-ID:  <20070319230404.GA3166@holestein.holy.cow>
In-Reply-To: <1174330341.26866.32.camel@shumai.marcuscom.com>
References:  <1174330341.26866.32.camel@shumai.marcuscom.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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

-- 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070319230404.GA3166>