From owner-freebsd-bugs@FreeBSD.ORG Wed Sep 19 02:50:02 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DAC516A421 for ; Wed, 19 Sep 2007 02:50:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C014113C481 for ; Wed, 19 Sep 2007 02:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l8J2o1jt004219 for ; Wed, 19 Sep 2007 02:50:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l8J2o1lH004218; Wed, 19 Sep 2007 02:50:01 GMT (envelope-from gnats) Resent-Date: Wed, 19 Sep 2007 02:50:01 GMT Resent-Message-Id: <200709190250.l8J2o1lH004218@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Garrett Wollman Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68AAB16A417 for ; Wed, 19 Sep 2007 02:43:12 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: from hergotha.csail.mit.edu (hergotha.csail.mit.edu [66.92.79.170]) by mx1.freebsd.org (Postfix) with ESMTP id DE40D13C45E for ; Wed, 19 Sep 2007 02:43:11 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: from hergotha.csail.mit.edu (localhost [127.0.0.1]) by hergotha.csail.mit.edu (8.13.8/8.13.8) with ESMTP id l8J2hAru041539 for ; Tue, 18 Sep 2007 22:43:10 -0400 (EDT) (envelope-from wollman@hergotha.csail.mit.edu) Received: (from wollman@localhost) by hergotha.csail.mit.edu (8.13.8/8.13.8/Submit) id l8J2hAl0041538; Tue, 18 Sep 2007 22:43:10 -0400 (EDT) (envelope-from wollman) Message-Id: <200709190243.l8J2hAl0041538@hergotha.csail.mit.edu> Date: Tue, 18 Sep 2007 22:43:10 -0400 (EDT) From: Garrett Wollman To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/116452: pkg_create uses bogosort? X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Garrett Wollman List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Sep 2007 02:50:02 -0000 >Number: 116452 >Category: bin >Synopsis: pkg_create uses bogosort? >Confidential: no >Severity: non-critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Sep 19 02:50:01 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Garrett Wollman >Release: FreeBSD 6.2-RELEASE-p3 i386 >Organization: >Environment: System: FreeBSD hergotha.csail.mit.edu 6.2-RELEASE-p3 FreeBSD 6.2-RELEASE-p3 #5: Sun Mar 18 00:59:50 EDT 2007 wollman@hergotha.csail.mit.edu:/usr/obj/usr/src/sys/HERGOTHA i386 >Description: pkg_create makes an insane number of pointless filesystem operations (quadratic? exponential?) when being run as part of the "Registering installation" step of a port install. It is definitely a function of the number of ports installed, as it has gotten much worse since X was fragmented into 200 separate packages. ktrace shows: [root@hergotha /home/wollman]# kdump -t n | wc -l 937814 [root@hergotha /home/wollman]# kdump -t n | sort -u | wc -l 1023 (This is actually only a partial ktrace, started about halfway through the process.) What it is actually trying to do, I do not know. A representative sample from the trace: 97936 pkg_create CALL lstat(0xbfbfbe20,0xbfbfb990) 97936 pkg_create NAMI "/var/db/pkg/glitz-0.5.6_1" 97936 pkg_create RET lstat 0 97936 pkg_create CALL access(0xbfbfbe20,0x4) 97936 pkg_create NAMI "/var/db/pkg/glitz-0.5.6_1" 97936 pkg_create RET access 0 97936 pkg_create CALL stat(0xbfbfba20,0xbfbfb990) 97936 pkg_create NAMI "/var/db/pkg/glitz-0.5.6_1/+CONTENTS" 97936 pkg_create RET stat 0 97936 pkg_create CALL access(0xbfbfba20,0x4) 97936 pkg_create NAMI "/var/db/pkg/glitz-0.5.6_1/+CONTENTS" 97936 pkg_create RET access 0 >How-To-Repeat: Install an already-compiled port on a machine that has lots of packages. Wait a few minutes. Wonder why it's not done yet. >Fix: Either use a less-stupid algorithm or at least memoize the result of whatever it's trying to do with this sequence of calls. >Release-Note: >Audit-Trail: >Unformatted: