Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Aug 2009 21:25:09 +0200 (CEST)
From:      Dan Lukes <dan@obluda.cz>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/138356: pkgdb -F + ALT_PKGDEP => broken logic
Message-ID:  <200908291925.n7TJP9d2001262@kulesh.obluda.cz>
Resent-Message-ID: <200908301840.n7UIe34Y011438@freefall.freebsd.org>

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

>Number:         138356
>Category:       ports
>Synopsis:       pkgdb -F + ALT_PKGDEP => broken logic
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 30 18:40:03 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Dan Lukes
>Release:        FreeBSD
>Organization:
Obludarium
>Environment:
System: FreeBSD 7.2-STABLE

but exact OS version is not relevant

portupgrade 2.4.6_3,2


>Description:
	pkgdb -F 
	deletes dependencies as irrelevant even they aren't

>How-To-Repeat:
	Imagine you have a system with 
databases/php5-mysqli and databases/mysql50-client
installed. The php5-mysqli depends on MySQL.

	Then upgrade MySQL 5.0 to MySQL 5.1
	Such upgrade is properly recorded in pkgtools.conf, e.g.:

  ALT_PKGDEP = {
        'databases/mysql50-client' => 'databases/mysql51-client',
        'databases/mysql50-server' => 'databases/mysql51-server',
  }


	Now, the php5-mysqli has unsatisfied dependency to (missing) 
databases/mysql50-client. 

	pkgdb -F needs to be run

	Unfortunately, it claim the missing dependency as irrelevant and delete it.

	It's example, of course. Simmilar problem can be seen on other
	cross-port upgrades, e.g.
	lang/perl5.8 -> lang/perl5.10, lang/python25->lang/python26 and more.

>Fix:

	There are two problems:

[1] the pkgdb search the ALT_PKGDEP only for package names, not for origins. 
The second example on pkgtools.conf/ALT_PKGDEP claims the origins can be used, 
but pkgdb ignore such variant. The databases/mysql50-client is NOT recognized 
when searching for mysql-client-5.0.75 port

Because the pkgdb found no regular nor alternative dependency to mysql-client-5.0.75
for php5-mysqli the dependency is deleted.

pkgdb should use both package name and origin when searching ALT_PKGDEP definition
so current call to 
alt(dep)
needs to be replaced with
alt(dep,origin)


[2] even in the case the pkgdb correctly identified the alternative dependency
(because it's written using package name, not origin) it misinterpret such 
information. In that acse the pkgdb SKIP further processing of the package, 
leaving it in uncorrected state.

The pkgdb should continue to repair the missing dependency of the package. The
fix is simple, because the code can correct the dependency correctly 
- only unnecesarry SKIP block them to do it.

The attached patch corrects both problems. 


--- patch-DAN-bin-pkgdb begins here ---
--- bin/pkgdb.orig	2009-08-28 23:47:36.000000000 +0200
+++ bin/pkgdb	2009-08-28 23:48:23.000000000 +0200
@@ -647,11 +647,12 @@
       puts "Stale dependency: #{pkgname} -> #{dep} (#{origin}):"
       if !$omit_check && !get_real_run_deps(pkgname).values.include?(origin)
         # Ignore dependencies which exist in ALG_PKGDEP
-	next if alt_dep(dep)
+	unless alt_dep(dep, origin)
 
 	puts "-> Deleted. (irrelevant)"
 	modify_pkgdep(pkgname, dep, :delete)
 	next
+	end
       end
 
       if config_held?(pkgname) && !$force
--- patch-DAN-bin-pkgdb ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



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