From nobody Sun Jul 02 08:09:05 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Qv1ss6fSKz4lFnQ; Sun, 2 Jul 2023 08:09:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qv1ss69F2z43Q3; Sun, 2 Jul 2023 08:09:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688285345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Dkdk2QiN3IeiNBwqFVEupqVwcjENV9nByg/iJXsj0WU=; b=AKobJrQFQJluEcKb9ISKoX1bUCa/6m3tBt28HqxMBaD0KyKj++WnA+FdTLuEsuMNoaSCfn TpWqw0HuvCtLcHOeLHD06CZ6sOT8p395c7R1RvYYzrq6ee1CYVI3PhL8JD70PmZgoz4WoZ wPYSd6Um+Fo2S3D7kOqvRRuNI1sfIiYV43ujPPPakk+qC2HVhggTPMek3GTewP07shPD0W Mwwi4RudBXmUvUDRtOBl78h7nRSr1g2rP2mJ76Z2DON7Q5CQYyWbqv/CpKyBNb1Aeh64Iq k1oi3/NVvuzRxUy1g+M4Ih0mZPnS7A4mU2zzfmvQR6Ywdow2LMU4Dl8H17EHvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688285345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Dkdk2QiN3IeiNBwqFVEupqVwcjENV9nByg/iJXsj0WU=; b=RgqZ9mXhfZgXIrZiL2UFMmHuag8qBjDhg40/qTD8QrDE7DIezf21jqsvf2DDVwxfN9Kyb2 y5LRtc5u8PoMp+FGqX7cKJXeGCs4rTdC4jp3Ci/MJT3Z8iE7xUUuUlYoyezDQl3U1lwJQk PaKfXZL7MQI8k4t+gZHVTP+3Rgt9JO2Di+FgUB6Pb45AS5lDXOCNX37Ahf9t26yeqivESt VuB/OZBznnDPJ0ua4OZDGlwwe/YuW0NaKaLns2Pt1ZPNPAXf1QmoICyuzoU5KaFAg7X5OR LTSHg8dUIltMhXqH4TxJZxzwgMpta6viBSs5JO5+OXdvsNJUYKbnLgEMlIqzjA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688285345; a=rsa-sha256; cv=none; b=VXkGMj+MHBUHyj4sVVHezPLm/wj0D6hlizgFX+TunoC6QBgX8hQr5KX4hlF78JOG3L5VK2 HcdMlCsmYIUZbbqHAKRsaI9QYI/kK3CfjQXmwo9rMPIdZaSjiA2K8D1Y2DAzSTqYDJo5e3 TVsYHfwSxjmT5G9UWQcQb9ACbRv6Mn7+++a/k2Zme42S3zCKBh2borOWnn7A24nx/tgM6r g/GecvtXiIaaTxvczKncCxaCtJ665AR2dQZCO2bZVIH/4iXav5L0eT7SHDixtVQ2FehGHb wrHPv/SGgLGmhelv6JotCqTfj4J1orQ3WNFV5GR3M2bpd7Fcgvc8I4HxjGR9Lw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Qv1ss5GQFz10f5; Sun, 2 Jul 2023 08:09:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3628952V027869; Sun, 2 Jul 2023 08:09:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 362895VW027868; Sun, 2 Jul 2023 08:09:05 GMT (envelope-from git) Date: Sun, 2 Jul 2023 08:09:05 GMT Message-Id: <202307020809.362895VW027868@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eugene Grosbein Subject: git: ccc806a04938 - main - dumpdev: respect kenv for stable branches List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ccc806a049383e5611b3752e6f384cf03a208039 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=ccc806a049383e5611b3752e6f384cf03a208039 commit ccc806a049383e5611b3752e6f384cf03a208039 Author: Eugene Grosbein AuthorDate: 2023-07-02 07:54:57 +0000 Commit: Eugene Grosbein CommitDate: 2023-07-02 07:54:57 +0000 dumpdev: respect kenv for stable branches We have somewhat twisted logic to determine actions for dumpdev considering three sources of information: * kenv "dumpdev" tunnable supposed to point to specific device; * /etc/defaults/rc.conf "dumpdev" variable; * /etc/rc.conf that may be unset or set to "NO", "AUTO" or device name. For CURRENT without any setting in kenv or /etc/rc.conf the default is "AUTO". For STABLE branches the default is "NO". Current implementation breaks for STABLE branches if kenv points to specific device but /etc/rc.conf does not set "dumpdev" at all. Let us fix it commenting out "dumpdev" in /etc/defaults/rc.conf for STABLE branches and making the code to consult kenv if "dumpdev" is not set elsewhere. MFC-after: 1 month --- libexec/rc/rc.conf | 4 +++- libexec/rc/rc.d/dumpon | 9 ++++++--- libexec/rc/rc.d/savecore | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index 06fda945e86e..8884fab7e016 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -643,7 +643,9 @@ lpd_flags="" # Flags to lpd (if enabled). nscd_enable="NO" # Run the nsswitch caching daemon. chkprintcap_enable="NO" # Run chkprintcap(8) before running lpd. chkprintcap_flags="-d" # Create missing directories by default. -dumpdev="AUTO" # Device to crashdump to (device name, AUTO, or NO). +dumpdev="AUTO" # Device to crashdump to (device name, AUTO, or NO); + # this should be commented out here + # for stable branches to respect kenv. dumpon_flags="" # Options to pass to dumpon(8), followed by dumpdev. dumpdir="/var/crash" # Directory where crash dumps are to be stored savecore_enable="YES" # Extract core from dump devices if any diff --git a/libexec/rc/rc.d/dumpon b/libexec/rc/rc.d/dumpon index 6ca335b73842..ed43c4a24762 100755 --- a/libexec/rc/rc.d/dumpon +++ b/libexec/rc/rc.d/dumpon @@ -52,15 +52,18 @@ dumpon_start() # early so a crash early in the boot process can be caught. # case ${dumpdev} in - [Nn][Oo] | '') + [Nn][Oo]) ;; - [Aa][Uu][Tt][Oo]) + [Aa][Uu][Tt][Oo] | '') root_hold_wait dev=$(/bin/kenv -q dumpdev) if [ -n "${dev}" ] ; then dumpon_try "${dev}" return $? fi + if [ -z ${dumpdev} ] ; then + return + fi while read dev mp type more ; do [ "${type}" = "swap" ] || continue case ${dev} in @@ -85,7 +88,7 @@ dumpon_start() dumpon_stop() { case ${dumpdev} in - [Nn][Oo] | '') + [Nn][Oo]) ;; *) rm -f /dev/dumpdev diff --git a/libexec/rc/rc.d/savecore b/libexec/rc/rc.d/savecore index 5d8204a1e805..e7186699a176 100755 --- a/libexec/rc/rc.d/savecore +++ b/libexec/rc/rc.d/savecore @@ -20,11 +20,11 @@ savecore_prestart() { # Quit if we have no dump device case ${dumpdev} in - [Nn][Oo] | '') + [Nn][Oo]) debug 'No dump device. Quitting.' return 1 ;; - [Aa][Uu][Tt][Oo]) + [Aa][Uu][Tt][Oo] | '') if [ ! -L /dev/dumpdev ]; then return 1 fi