Bug in portupgrade

Olivier Certner olivier.certner at free.fr
Sun Jul 10 21:11:46 GMT 2005


	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


More information about the freebsd-hackers mailing list