From owner-freebsd-bugs@FreeBSD.ORG Tue Mar 11 22:40:01 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E5485701 for ; Tue, 11 Mar 2014 22:40:00 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C1DFFC84 for ; Tue, 11 Mar 2014 22:40:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.8/8.14.8) with ESMTP id s2BMe0JG041019 for ; Tue, 11 Mar 2014 22:40:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s2BMe0t3041018; Tue, 11 Mar 2014 22:40:00 GMT (envelope-from gnats) Resent-Date: Tue, 11 Mar 2014 22:40:00 GMT Resent-Message-Id: <201403112240.s2BMe0t3041018@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, Adam McDougall Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 94E4A5DB for ; Tue, 11 Mar 2014 22:36:26 +0000 (UTC) Received: from cgiserv.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 82060C4B for ; Tue, 11 Mar 2014 22:36:26 +0000 (UTC) Received: from cgiserv.freebsd.org ([127.0.1.6]) by cgiserv.freebsd.org (8.14.8/8.14.8) with ESMTP id s2BMaQFw009096 for ; Tue, 11 Mar 2014 22:36:26 GMT (envelope-from nobody@cgiserv.freebsd.org) Received: (from nobody@localhost) by cgiserv.freebsd.org (8.14.8/8.14.8/Submit) id s2BMaQAI009093; Tue, 11 Mar 2014 22:36:26 GMT (envelope-from nobody) Message-Id: <201403112236.s2BMaQAI009093@cgiserv.freebsd.org> Date: Tue, 11 Mar 2014 22:36:26 GMT From: Adam McDougall To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: bin/187458: sysrc silently and unexpectedly bootstraps pkg X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Mar 2014 22:40:01 -0000 >Number: 187458 >Category: bin >Synopsis: sysrc silently and unexpectedly bootstraps pkg >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Mar 11 22:40:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: Adam McDougall >Release: 10.0-STABLE >Organization: >Environment: FreeBSD build10 10.0-STABLE FreeBSD 10.0-STABLE #0 r262298: Fri Feb 21 18:28:26 EST 2014 root@build10:/usr/obj/usr/src/sys/BUILD10 amd64 >Description: Recently I began setting up some fresh FreeBSD installs and I used sysrc to enable some services in /etc/rc.conf that I would use later on. From a fresh install, I have no ports or packages installed. A few steps later I ran 'pkg bootstrap' and it told me pkg was already installed. Huh? The first time I thought I was crazy, the second time I tracked it down. When sysrc runs, it runs some subroutines from /usr/share/bsdconfig/common.subr which runs "ASSUME_ALWAYS_YES=1 pkg -vv" which will bootstrap pkg silently if it can, because it is not installed and it was told to assume yes. In my environment, the end result is not problematic but it is confusing and very unexpected, especially the brief delay during the first execution while it bootstraps. >How-To-Repeat: on a system without pkg installed but with sysrc, run: script output.log sh -x `which sysrc` test=yes In output.log you'll see sysrc call /usr/share/bsdconfig/common.subr which runs "ASSUME_ALWAYS_YES=1 pkg -vv" which will bootstrap pkg silently. to check status, but if pkg is not already bootstrapped, it will silently attempt to and continue on after a short delay if it succeeds. >Fix: No specific fix suggestion. If there is a way to check if pkg is actually installed and not just the /usr/sbin/pkg stub, maybe the full "ASSUME_ALWAYS_YES=1 pkg -vv" execution could be avoided. Checking for /usr/local/sbin/pkg may be insufficient if some has it in a custom path. >Release-Note: >Audit-Trail: >Unformatted: