From owner-freebsd-ports-bugs@FreeBSD.ORG Sat Jul 15 18:50:14 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7B8BA16A4E2 for ; Sat, 15 Jul 2006 18:50:14 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id ED12C43D55 for ; Sat, 15 Jul 2006 18:50:13 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k6FIoDVw052320 for ; Sat, 15 Jul 2006 18:50:13 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k6FIoDXw052319; Sat, 15 Jul 2006 18:50:13 GMT (envelope-from gnats) Resent-Date: Sat, 15 Jul 2006 18:50:13 GMT Resent-Message-Id: <200607151850.k6FIoDXw052319@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Mike Andrews Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A0DC416A4DA for ; Sat, 15 Jul 2006 18:42:10 +0000 (UTC) (envelope-from mandrews@bit0.com) Received: from mindcrime.bit0.com (bit0.com [216.24.42.169]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3EFB343D55 for ; Sat, 15 Jul 2006 18:42:09 +0000 (GMT) (envelope-from mandrews@bit0.com) Received: by mindcrime.bit0.com (Postfix, from userid 502) id B2D58730003; Sat, 15 Jul 2006 14:42:08 -0400 (EDT) Message-Id: <20060715184208.B2D58730003@mindcrime.bit0.com> Date: Sat, 15 Jul 2006 14:42:08 -0400 (EDT) From: Mike Andrews To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/100350: www/apache20 profiles not working at system startup/shutdown time due to unexpected $0 value X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Mike Andrews List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2006 18:50:14 -0000 >Number: 100350 >Category: ports >Synopsis: www/apache20 profiles not working at system startup/shutdown time due to unexpected $0 value >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jul 15 18:50:13 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Mike Andrews >Release: FreeBSD 6.1-STABLE amd64 >Organization: Fark.com LLC >Environment: System: FreeBSD mindcrime.bit0.com 6.1-STABLE FreeBSD 6.1-STABLE #1: Fri Jul 14 18:53:37 EDT 2006 mandrews@mindcrime.bit0.com:/usr/obj/usr/src/sys/MINDCRIME amd64 Also happens on 6.1-RELEASE-p2 i386 GENERIC or SMP >Description: When using the latest apache20 port (from July 14 2006 portsnap) and the profiles feature to run multiple httpd's on one system (or even just a single profile), such as the following in /etc/rc.conf: apache2_enable="YES" apache2_profiles="0DEV" apache2_0DEV_flags="-DServer0DEV" apache2_0DEV_configfile="/usr/local/etc/apache2/httpd2-test.conf" Manually using "/usr/local/etc/rc.d/apache2.sh start 0DEV" (or stop or reload or restart) works fine. Manually using "/usr/local/etc/rc.d/apache2.sh start" (or stop or reload but NOT restart) works fine. restart not working may be related to ports/86402 but that's not that this PR is about :) At system boot time though, it fails to start Apache with the following error: ===> apache2 profile: 0DEV /usr/local/etc/rc.d/apache2.sh: /etc/rc: Permission denied On line 73 of /usr/local/etc/rc.d/apache2.sh is a line "$0 $1 $profile" that's used to re-run apache2.sh for each individual profile. If I put $0 into the "echo" line above it, it says $0 is "/etc/rc.d" so it fails when it tries to re-run the wrong script. The upshot is I have to manually restart Apache after a reboot. At system shutdown $0 gets mangled into "/etc/rc.shutdown" instead of "/usr/local/etc/rc.d/apache2.sh" the same way. If I create a simple /usr/local/etc/rc.d/test.sh script containing just #!/bin/sh echo Hello, I seem to be $0 then it prints /usr/local/etc/rc.d/test.sh as expected. Putting that as the first line in /usr/local/etc/rc.d/apache.2.sh prints /etc/rc at startup, /etc/rc.shutdown at shutdown and /usr/local/etc/rc.d/apache2.sh when run manually. 'm not sure why that one is different. It does run earlier than some of the others. With no profiles enabled everything works fine because it never needs to reference $0 in that case. >How-To-Repeat: Install www/apache20 on a system (or jail), add the above variables to /etc/rc.conf, and restart the system (or jail); if a jail then check /var/log/console.log for the above error messages. >Fix: Using $_file instead of $0 works for system boot but breaks the manual case. Perhaps using $_file if it exists and $0 when it doesn't? There is the possibility that I've done something stupid to my /etc/rc.conf, (like not using the apache20 profile variables correctly) or that I have another port whose rc.d script is trashing $0 somehow, or that I just plain don't understand the rc system. :) >Release-Note: >Audit-Trail: >Unformatted: