Bug 81088 - portupgrade-20041226_2 unnecessarily update pkgdb
Summary: portupgrade-20041226_2 unnecessarily update pkgdb
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Simon L. B. Nielsen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-16 05:00 UTC by kasahara
Modified: 2005-05-25 09:41 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kasahara 2005-05-16 05:00:28 UTC
When using tools of the portupgrade package including portupgrade, portinstall,
portversion etc, the package db file is frequently updated unnecessarily even
when there is no update in the package list... like this:

--->  Backing up the old version
[Updating the pkgdb <format:bdb1_btree> in /var/db/pkg ... - 812 packages found (-0 +0)  done]
--->  Uninstalling the old version
[Updating the pkgdb <format:bdb1_btree> in /var/db/pkg ... - 812 packages found (-0 +0)  done]
--->  Deinstalling 'smartmontools-5.32'

I believe this behavior started to appear after the latest patch to fix 
a vulnerability of portupgrade.

Fix: 

pkgdb.rb checks the timestamp of db_dir (/var/db/pkg) against db_file to 
determine whether updating pkgdb.db is needed.  After the fix for the 
vulnerability, pkgdb.fixme is created inside /var/db/pkg, so the deletion of
the file also alters the timestamp of the directory.  It causes extra 
update of pkgdb.db.  Please place pkgdb.fixme file elsewhere, or change logic
of pkgdb.rb (I don't fully understand the logic, so I cannot tell the detail).
How-To-Repeat: 
Run portversion (which doesn't modify installed packages) then run
pkgdb -u to see it updates pkgdb.db even when there is no change.
Comment 1 Pav Lucistnik freebsd_committer freebsd_triage 2005-05-16 18:39:32 UTC
Responsible Changed
From-To: freebsd-ports-bugs->simon

Simon broke it 

http://www.freebsd.org/cgi/query-pr.cgi?pr=81088 

Simon did this:
http://people.freebsd.org/~simon/patches/port-portupgrade-CAN-2005-0610_3.patch
Comment 2 Simon L. B. Nielsen freebsd_committer freebsd_triage 2005-05-18 23:04:17 UTC
State Changed
From-To: open->analyzed

The following patch, which I expect to be commited very soon, 
should fix the problem: 

http://people.freebsd.org/~simon/patches/port-portupgrade-CAN-2005-0610_3.patch
Comment 3 kasahara 2005-05-19 02:59:58 UTC
On Wed, 18 May 2005 22:05:22 GMT,
	"Simon L. Nielsen" <simon@FreeBSD.org> said:

> The following patch, which I expect to be commited very soon,
> should fix the problem:
> 
> http://people.freebsd.org/~simon/patches/port-portupgrade-CAN-2005-0610_3.patch

The 'pkgdb.fixme' file is shared among commands of portupgrade.  For
example, if 'pkgdb -u' is interrupted before finish, 'pkgdb.fixme' is
remained.  Subsequent invocation of commands will notice it and try to
re-run 'pkgdb -u' before doing their main task.

So, everytime creating different tmpdir will break them too, I believe.
Comment 4 Simon L. B. Nielsen freebsd_committer freebsd_triage 2005-05-20 00:01:23 UTC
On 2005.05.19 02:00:25 +0000, Yoshiaki Kasahara wrote:

>  On Wed, 18 May 2005 22:05:22 GMT,
>  	"Simon L. Nielsen" <simon@FreeBSD.org> said:
>  
>  > The following patch, which I expect to be commited very soon,
>  > should fix the problem:
>  > 
>  > http://people.freebsd.org/~simon/patches/port-portupgrade-CAN-2005-0610_3.patch
>  
>  The 'pkgdb.fixme' file is shared among commands of portupgrade.  For
>  example, if 'pkgdb -u' is interrupted before finish, 'pkgdb.fixme' is
>  remained.  Subsequent invocation of commands will notice it and try to
>  re-run 'pkgdb -u' before doing their main task.
>  
>  So, everytime creating different tmpdir will break them too, I believe.


Hmm, I suspect that you are right :-/.

-- 
Simon L. Nielsen
Comment 5 kasahara 2005-05-22 11:56:39 UTC
On Sun, 22 May 2005 01:11:04 +0200,
	"Simon L. Nielsen" <simon@freebsd.org> said:

> Could you try the attached patch and see if it works for you?

It works fine for me.  Thank you very much!
-- 
kasahara@nc.kyushu-u.ac.jp
Comment 6 Simon L. B. Nielsen freebsd_committer freebsd_triage 2005-05-25 09:40:19 UTC
State Changed
From-To: analyzed->closed

This should now been fixed with portupgrade-20041226_3. 
Thanks for the report!