7-CURRENT

Parv parv at pair.com
Mon May 8 17:41:52 UTC 2006


in message <c6ef380c0605080448x34751450x7399dd2848bfb11e at mail.gmail.com>,
wrote Perttu Laine thusly...
>
> Thank's. work fine. Now I have another question about 7-CURRENT.
> portupgrade and portversion are giving this error:
> ---
> uname(1) could be broken - cannot parse the output: 7-CURRENT-SNAP009 i386
> ** Error occured reading /usr/local/etc/pkgtools.conf:
>        uninitialized constant PkgConfig::OS_PLATFORM
> ---
>
> So. How can one make those pkgtools working? :)

That seems like a bug in portupgrade (pkgtools.rb is installed as
part of portupgrade) due to, most likely, limited set of rules to
parse uname(1) output.  Please file a problem report via send-pr(1).

I can't help myself but look in source; here is the line 982 in
pkgtools.rb (portupgrade 2.0.1_1,1) which fails to parse uname(1)
output ...

  980   uname = `uname -rm`.chomp
  981
  982   if m = /^(((\d+)(?:\.\d+[^.\-]*?)+)-(\w+)(-\S+)?) (\w+)$/.match(uname)
                    ^ ^     ^ ^ ^ ^ ^ ^  ^   ^ ^  ^ ^      ^ ^
                    ^ ^     ^ ^ ^ ^ ^ ^  ^   ^ ^  ^ ^      ^ ^
                            minor        ^
                            version      required minor
                                         version match

  983     OS_RELEASE, OS_REVISION, OS_MAJOR,
  984       OS_BRANCH, os_patchlevel, OS_PLATFORM = m[1..-1]
  985     OS_PATCHLEVEL = os_patchlevel || ""

(I don't know how close Ruby & Perl regular expressions (regexps) are,
below analysis is according to Perl rules.)  Above regex fails, when
there is no minor version since matching of minor version is not
optional.  To get past that,  regex should be ...

    /^(((\d+)(?:\.\d+[^.\-]*?)?)-(\w+)(-\S+)?) (\w+)$/
                              ^
                              ^ optional match


  - Parv

-- 



More information about the freebsd-questions mailing list