Bug 151662

Summary: ports-mgmt/portupgrade: upgrade of autoconf leaves old version
Product: Ports & Packages Reporter: mwisnicki+freebsd
Component: Individual Port(s)Assignee: Bryan Drewery <bdrewery>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description mwisnicki+freebsd 2010-10-23 16:20:05 UTC
After running `portupgrade -a` I'm left with two versions of autoconf installed:

# pkg_info -Qo autoconf-2.67 autoconf-2.68
autoconf-2.67:devel/autoconf268
autoconf-2.68:devel/autoconf268

Notice how origin of autoconf-2.67 is wrong, it must have been edited by portupgrade. Modification time of /var/db/pkg/autoconf-2.67/+CONTENTS confirms that. It happened probably because of:
/usr/ports/MOVED:devel/autoconf267|devel/autoconf268|2010-10-16|Bump

Now when I run `portupgrade -a`, it will try to update autoconf-2.67 to 2.68 and fail since it is already installed.

There is some problem with handling of MOVED in portupgrade that causes it to leave old packages installed (sometimes?).

Fix: 

No fix but workaround is to deinstall old package.
In case of autoconf this is simple since there are no file conflicts between versions. For other ports you will have to deinstall both versions and then reinstall newer.
How-To-Repeat: 1. Deinstall all auto* packages
2. Checkout ports from before 16 Oct 2010
3. Install autoconf267
4. Update ports to 17 Oct 2010
5. Run `portupgrade -a`
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2010-10-23 16:20:12 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ruby

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Philip M. Gollucci freebsd_committer freebsd_triage 2010-11-11 02:33:38 UTC
Responsible Changed
From-To: ruby->freebsd-ports-bugs

back
Comment 3 Steve Price freebsd_committer freebsd_triage 2011-01-03 17:26:11 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ruby

Over to maintainer(s).
Comment 4 Steve Wills freebsd_committer freebsd_triage 2011-08-21 21:24:51 UTC
Responsible Changed
From-To: ruby->swills

I'll take it.
Comment 5 Steve Wills freebsd_committer freebsd_triage 2011-08-21 21:32:32 UTC
State Changed
From-To: open->closed

Suspect this is due to the old way autoconf was maintained with 
different dirs for each version. The old way required one to portupgrade 
-o devel/autoconf268 devel/autoconf278 instead of portupgrade -a, and 
there was often a note about this in UPDATING. Calling portupgrade -a 
would require the workaround submitter suggested (remove old version). 
In that case, this wouldn't be considered a bug in portupgrade. 
Regardless, autoconf is no longer maintained or updated with the version 
number in the port dir, so it's difficult or impossible to test this. 
Based on all that, I'm closing this bug for now. If you have further 
issues, please submit a new PR.
Comment 6 mwisnicki+freebsd 2011-08-22 00:32:13 UTC
On Sun, Aug 21, 2011 at 22:32,  <swills@freebsd.org> wrote:
> Synopsis: ports-mgmt/portupgrade: upgrade of autoconf leaves old version
> Regardless, autoconf is no longer maintained or updated with the version
> number in the port dir, so it's difficult or impossible to test this.

Well you can test older versions of ports. It's not a problem of
autoconf port but a broken handling of MOVED by portupgrade.
Similar things happen with different ports too.
Since portupgrade didn't not have separate bug tracker I have filled this here.
Now, there is an "official" project on github so I'm going to complain there.

> Based on all that, I'm closing this bug for now. If you have further
> issues, please submit a new PR.
>
> http://www.freebsd.org/cgi/query-pr.cgi?pr=151662
>
Comment 7 Steve Wills freebsd_committer freebsd_triage 2011-08-22 04:58:35 UTC
State Changed
From-To: closed->open

re-open, my previous analysis was incorrect
Comment 8 Steve Wills freebsd_committer freebsd_triage 2011-08-22 05:00:11 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/21/11 19:32, Marcin Wisnicki wrote:
> On Sun, Aug 21, 2011 at 22:32,  <swills@freebsd.org> wrote:
>> Synopsis: ports-mgmt/portupgrade: upgrade of autoconf leaves old version
>> Regardless, autoconf is no longer maintained or updated with the version
>> number in the port dir, so it's difficult or impossible to test this.
> 
> Well you can test older versions of ports. It's not a problem of
> autoconf port but a broken handling of MOVED by portupgrade.
> Similar things happen with different ports too.
> Since portupgrade didn't not have separate bug tracker I have filled this here.
> Now, there is an "official" project on github so I'm going to complain there.

I just spent at least 3 hours tracking this down... It took forever to
get the right setup to test it. Here's what I did:

1. Installed 8.1-RELEASE
2. install a bunch of stuff, enough to get autoconf-267 as a dependency
3. grab the ports tree from 2010/10/15
4. install portupgrade (latest copy, with even some patches I have for 1.9)
5. take a VM snapshot at this point

- From here, I used the snapshot to do this:

1. grab the tree from 2010/10/17
2. run portupgrade -a

I did witness the bug as reported in the original bug report. So, the
bug is still there. Now, I went back to the snapshot and did this:

1. using the tree from 2010/10/15, portupgrade -a. note at this point
autoconf-267 was still in use. so, now everything is up to date.
2. update the tree to 2010/10/17.
3. run portupgrade -a and see autoconf updated to autoconf-268 per the
moved file

The bug didn't happen. Why? It seems to me this indicates portupgrade
isn't following MOVED for dependencies, only for direct updates. In
fact, when I saw the bug, it wasn't portupgrade that actually installed
the second copy of autoconf, it was just a side effect of the way
portupgrade updated something else. So I went back and re-did the step
where I saw the bug (yay virtualbox snapshots) with portupgrade -arR
instead of portupgrade -a, thinking that would make it find the
autoconf-268 upgrade first, but it did not. So this is definitely a bug
in portupgrade.

My previous analysis suggesting that one portupgrade -o was completely
incorrect. That's simply a work around that I'd become far too
accustomed to. This is a bug and does need to be fixed. I'll re-open the
case. My apologies for the incorrect analysis.

Steve
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (FreeBSD)

iQEcBAEBAgAGBQJOUdRKAAoJEPXPYrMgexuhXC8IAIbSMAq7lki6so2ZbR75/j6M
VEuJOd+KEgGuGFOMxzkP4WSz6n4VmqKjrGV69jT7YYr0UV54hQ4AtU2U8ybcsrwe
sWE6rjeSmIFSZ4rEbAQH2TExx58wzjiMAngBK5IgmnSK5rruziyDo1YN5O3StUAt
FI0bA4qNzFu5sWtnEgDmzcTQC5b1kJhqsEJM9mzIpHwIHSq7Cx8DMOzgFyFo7vq5
/mBBZbsduVY/ROB+wfpORXQ/45zMwDr61q613JvAYwqS1sOc0ctMDRkpggoP/bNg
EL4eB/G0+roxdV2QzfOph33WqWyxWl8UvUf1Pd6ZFKjrsvh8xHEu5fA+OuyOTBo=
=j3S7
-----END PGP SIGNATURE-----
Comment 9 mwisnicki 2011-08-30 17:28:50 UTC
Cross referencing upstream bug: https://github.com/stass/pkgtools/issues/2
Comment 10 Steve Wills freebsd_committer freebsd_triage 2011-10-27 15:44:52 UTC
Responsible Changed
From-To: swills->ruby

Back to the pool
Comment 11 Philip M. Gollucci freebsd_committer freebsd_triage 2012-02-22 05:24:19 UTC
State Changed
From-To: open->suspended

Over to maintainer. 


Comment 12 Philip M. Gollucci freebsd_committer freebsd_triage 2012-02-22 05:24:19 UTC
Responsible Changed
From-To: ruby->freebsd-ports-bugs

Over to maintainer.
Comment 13 Chris Rees freebsd_committer freebsd_triage 2012-04-12 11:03:25 UTC
State Changed
From-To: suspended->open

This should not be suspended.
Comment 14 Bryan Drewery 2012-05-30 02:30:26 UTC
Updated upstream tracker: https://github.com/pkgtools/pkgtools/issues/2
Comment 15 Bryan Drewery freebsd_committer freebsd_triage 2012-08-02 14:06:06 UTC
Responsible Changed
From-To: freebsd-ports-bugs->bdrewery

Over to maintainer.
Comment 16 Bryan Drewery freebsd_committer freebsd_triage 2012-08-14 22:18:14 UTC
State Changed
From-To: open->analyzed

This is fixed upstream. Will be released in next version.
Comment 17 dfilter service freebsd_committer freebsd_triage 2012-08-26 04:15:42 UTC
Author: bdrewery
Date: Sun Aug 26 03:15:31 2012
New Revision: 303176
URL: http://svn.freebsd.org/changeset/ports/303176

Log:
  - Update to 2.4.9.8
  
  Changelog:
  
    * Fix MOVED tracking when upgrading ports [1]
    * Track and display deleted ports when upgrading
    * Automatically set DISABLE_CONFLICTS when moving origins
    * Fix crash when running portupgrade inside of a WRKDIR
    * Fix "Frozen string" error with ruby 1.9 when using the
      {BEFORE,AFTER}{INSTALL,DEINSTALL} hooks in pkgtools.conf
    * Fix failure being seen as success due to broken script(1) on
      older systems [2][3]. This is done by installing a more recent
      script(1) into PREFIX/libexec/pkgtools and using it instead.
      Only installed/used on FreeBSD 8.0 and earlier.
  
  PR:		ports/151662 [1], ports/147242 [2],
  		ports/131111 [3]
  Approved by:	eadler (mentor)

Modified:
  head/ports-mgmt/portupgrade/Makefile
  head/ports-mgmt/portupgrade/distinfo
  head/ports-mgmt/portupgrade/pkg-plist

Modified: head/ports-mgmt/portupgrade/Makefile
==============================================================================
--- head/ports-mgmt/portupgrade/Makefile	Sun Aug 26 02:54:49 2012	(r303175)
+++ head/ports-mgmt/portupgrade/Makefile	Sun Aug 26 03:15:31 2012	(r303176)
@@ -6,7 +6,7 @@
 #
 
 PORTNAME=	portupgrade
-PORTVERSION=	2.4.9.7
+PORTVERSION=	2.4.9.8
 PORTEPOCH=	2
 CATEGORIES=	ports-mgmt
 MASTER_SITES=	SF/portupgrade/pkgtools/dist/ \
@@ -29,12 +29,13 @@ BDB4_DESC=	Use Berkeley DB >=2
 
 CONFLICTS_INSTALL=	portupgrade-devel-*
 
+DIST_SUBDIR=	${PORTNAME}
 USE_BZIP2=	yes
 USE_RUBY=	yes
 
 USE_LDCONFIG=	${PREFIX}/lib/compat/pkg
 
-MAKE_ARGS=	PREFIX="${PREFIX}" RUBY="${RUBY}"
+MAKE_ARGS=	PREFIX="${PREFIX}" RUBY="${RUBY}" RUBY_SITELIBDIR="${RUBY_SITELIBDIR}" MKDIR="${MKDIR}"
 
 MAN1=		pkg_deinstall.1 \
 		pkg_fetch.1 \
@@ -76,6 +77,14 @@ RUN_DEPENDS+=	${RUBY_SITEARCHLIBDIR}/bdb
 RUN_DEPENDS+=	${RUBY_SITELIBDIR}/parsedate.rb:${PORTSDIR}/devel/ruby-date2
 .endif
 
+# Need to install working script(1)
+.if ${OSVERSION} < 801000
+PLIST_SUB+=	SCRIPT=""
+MAKE_ENV+=	NEED_COMPAT_SCRIPT=yes
+.else
+PLIST_SUB+=	SCRIPT="@comment "
+.endif
+
 pre-extract:
 .if exists(${RUBY_SITEARCHLIBDIR}/bdb.so) && ${PORT_OPTIONS:MBDB1}
 	@${ECHO_MSG} "================================================================="

Modified: head/ports-mgmt/portupgrade/distinfo
==============================================================================
--- head/ports-mgmt/portupgrade/distinfo	Sun Aug 26 02:54:49 2012	(r303175)
+++ head/ports-mgmt/portupgrade/distinfo	Sun Aug 26 03:15:31 2012	(r303176)
@@ -1,2 +1,2 @@
-SHA256 (pkgtools-2.4.9.7.tar.bz2) = 9aa5eb67fc4a48d721f36491eca45d7a05760886bae768d498b962bf5fc58cd3
-SIZE (pkgtools-2.4.9.7.tar.bz2) = 80323
+SHA256 (portupgrade/pkgtools-2.4.9.8.tar.bz2) = 3368982aa7c27aa754485f546dff7c56715423074709582bbd4705d786058529
+SIZE (portupgrade/pkgtools-2.4.9.8.tar.bz2) = 83214

Modified: head/ports-mgmt/portupgrade/pkg-plist
==============================================================================
--- head/ports-mgmt/portupgrade/pkg-plist	Sun Aug 26 02:54:49 2012	(r303175)
+++ head/ports-mgmt/portupgrade/pkg-plist	Sun Aug 26 03:15:31 2012	(r303176)
@@ -26,6 +26,12 @@ sbin/portversion
 %%RUBY_SITELIBDIR%%/portinfo.rb
 %%RUBY_SITELIBDIR%%/ports.rb
 %%RUBY_SITELIBDIR%%/portsdb.rb
+@dirrmtry %%RUBY_SITELIBDIR%%
+@dirrmtry lib/ruby/site_ruby
+@dirrmtry lib/ruby
+%%SCRIPT%%@exec mkdir -p %D/libexec/pkgtools 2> /dev/null
+%%SCRIPT%%libexec/pkgtools/script
+%%SCRIPT%%@dirrm libexec/pkgtools
 @unexec if cmp -s %D/etc/pkgtools.conf %D/etc/pkgtools.conf.sample; then rm -f %D/etc/pkgtools.conf; fi
 etc/pkgtools.conf.sample
 @exec [ -f %B/pkgtools.conf ] || cp %B/%f %B/pkgtools.conf
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 18 Bryan Drewery freebsd_committer freebsd_triage 2012-08-26 17:56:08 UTC
State Changed
From-To: analyzed->closed

Closing as this is now fixed.