ports/138356: pkgdb -F + ALT_PKGDEP => broken logic

Dan Lukes dan at obluda.cz
Sun Aug 30 18:40:06 UTC 2009


>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:



More information about the freebsd-ports-bugs mailing list