Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jul 2005 23:13:12 +0200
From:      Olivier Certner <olivier.certner@free.fr>
To:        freebsd-hackers@freebsd.org
Subject:   Bug in portupgrade
Message-ID:  <200507102313.12719.olivier.certner@free.fr>

next in thread | raw e-mail | index | archive | help
	Hi,

	There is a bug with portupgrade when it is used to upgrade already compiled 
and installed ports for which some dependencies have been deleted in the 
package database. This causes a crash in the function 'deorigin' in pkgdb.rb.

	Since I don't know the internals of portupgrade, I don't know if it's normal 
to call 'deorigin' with its argument set to nil. If it is, then the patch 
below might be useful (beware, I don't know any ruby, I've just tried 
something and it works), if it is not, I only can provide the stack (see 
below) in order for maintainers to seek the faulty callers.

	Regards,

		Olivier

---------------
/usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:323:in `deorigin': cannot convert 
nil into String (PkgDB::DBError)
        from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:916:in `tsort_build'
        from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:915:in `each'
        from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:915:in `tsort_build'
        from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:907:in `each'
        from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:907:in `tsort_build'
        from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:929:in `sort_build'
        from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:933:in `sort_build!'
        from /usr/local/sbin/portupgrade:674:in `main'
        from /usr/local/sbin/portupgrade:207:in `initialize'
        from /usr/local/sbin/portupgrade:207:in `new'
        from /usr/local/sbin/portupgrade:207:in `main'
        from /usr/local/sbin/portupgrade:1869
---------------
*** /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb~ Mon Jul  4 00:05:41 2005
--- /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb  Mon Jul  4 00:09:34 2005
***************
*** 313,323 ****
    def deorigin(origin)
      open_db

!     if str = @db['?' + origin]
!       str.split
      else
        nil
      end
    rescue => e
      raise DBError, e.message
    end
--- 313,328 ----
    def deorigin(origin)
      open_db

!     if origin != nil
!       if str = @db['?' + origin]
!       str.split
!       else
!       nil
!       end
      else
        nil
      end
+
    rescue => e
      raise DBError, e.message
    end



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