Ticket #11971 (assigned defect)

Opened 1 year ago

Last modified 3 months ago

BUG: "port -u -f upgrade installed" created many nested directories

Reported by: freebsd@generalresources.com Assigned to: jmr@macports.org (accepted)
Priority: High Milestone: MacPorts 1.6.1
Component: base Version: 1.4
Keywords: haspatch Cc:

Description

This is probably related to #10827 where upgrade repeats infinitely.

I have about 30 ports installed an attempted to force update to get rid of old libraries; I aborted the attempt after running for 50 hours.

When examining the /opt/local/var directory to determine why it was taking so long I noticed a lot of extra disk space was consumed by the distfiles and packages sub directories.

For example: distfiles/gettext had a copy of the .tar.bz2 plus another gettext subdirectory. This 2nd gettext directory only had a gettext subdirectory. The 3rd level had the .tar.bz2 and a gettext subdirectory.

This alternating pattern was repeated:

* The 4th, 6th, ... were like the second - just subdirectory.

* The 5th, 7th, ... included a copy of the .tar.bz2 files.

In total an extra 9 copies of gettext files; libiconv was similar. Many others had the same problem but usually only 3 to 5 extra copies.

A similar situation existed in the packages directory where darwin/powerpc was nested many times with copies of the compiled packages at each powerpc subdirectory.

removing all the duplicates recovered about 300MB of disk space.

Attachments

multi-init.diff (8.6 kB) - added by jmr@macports.org on 2008-05-06 19:17:40.
proposed fix

Change History

2007-05-16 05:25:03 changed by freebsd@generalresources.com

Some system information: (for PowerBook G4/1.33GHz/256MB)

uname -v

Darwin Kernel Version 8.9.0: Thu Feb 22 20:54:07 PST 2007; root:xnu-792.17.14~1/RELEASE_PPC

port --version

MacPorts 1.440

gcc --version

powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5367)

2007-08-12 07:36:03 changed by nox@macports.org

  • priority changed from Important to High.
  • summary changed from "port -u -f upgrade installed" created many nested directories to BUG: "port -u -f upgrade installed" created many nested directories.
  • milestone set to MacPorts base bugs.

2007-08-14 08:23:13 changed by jmpp@macports.org

  • component changed from ports to base.

2008-05-06 06:28:08 changed by jmr@macports.org

  • cc set to jmr@macports.org.

Looks like this is due to multiple invocations of fetch_init and archive_init, where dist_subdir is appended to distpath, and os.platform & os.arch are appended to archive.destpath, respectively.

2008-05-06 19:17:40 changed by jmr@macports.org

  • attachment multi-init.diff added.

proposed fix

2008-05-06 19:19:16 changed by jmr@macports.org

  • milestone changed from MacPorts base bugs to MacPorts 1.6.1.

Unarchive could have been affected as well. The attached patch should make it harmless to call fetch_init, archive_init, and unarchive_init more than once.

Nominating this for the upcoming release.

2008-05-07 02:51:34 changed by jmr@macports.org

  • keywords set to haspatch.

2008-05-08 04:51:39 changed by raimue@macports.org

This patch looks good.

2008-05-11 01:12:38 changed by jmr@macports.org

  • cc deleted.
  • owner changed from macports-tickets@lists.macosforge.org to jmr@macports.org.
  • status changed from new to assigned.

2008-05-11 01:19:23 changed by jmr@macports.org

Patch committed to trunk in r36679. Thanks for reviewing, Rainer!

Is there a simple test case we can use to ensure that the problem is really fixed?

2008-05-11 15:37:57 changed by jmr@macports.org

Backed out the fetch part of the change in r36687 (hadn't thought through the other places where distpath is used). Committed a smaller, working fix in r36688.