From nobody Sun Jun 1 19:54:06 2025 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 4b9SNK1Ds3z5y5tl; Sun, 01 Jun 2025 19:54:09 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4b9SNH33ynz3t2L; Sun, 01 Jun 2025 19:54:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1748807648; 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=WveE0NAu5vpJJ9w9E72Y+q7RJYrVVKZzjtcc3+gETis=; b=oeY+DtiZHfF+wfjHrQBAFdhqPX4FoRjYYsZGfGQgGQPhsuwMINPjwoXm197VGJJTkU+amf 3IsvEqLRi1INPCNBalc3bKYj8EAljfxSi2Kk7oMWJ33oFRfFD5WH0fhBtdiereCyGLmdgV YZ3+5IWoU7Z2Jx8ZJTVhX5zWukSnzBtOsA796NJxssXf6cMhY70l2x1mryevAyQZZ68akQ wdVJTtY4Zq59IgNLoz5wuL6umf2G5JEsN8iG/coFvD9ID8BPHRV99pzR/aXqmoBG/j5YDA tZUbpUcLJ8ett1FZo041MraW7rrURywriujum57jQvInA2zr5UqjEv1PnWPptA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1748807647; 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=WveE0NAu5vpJJ9w9E72Y+q7RJYrVVKZzjtcc3+gETis=; b=Hy0ks+v7eSgwTu/AwkL2ZCdpj2SV7foTLn1VV2Ot6IwhnTcvScrik0FmbIR6C6Ndpz/Xqt gtl0VfOf7I+phE7EW131bajHTViuqjjFsma3ADWxlACJo35SiJzwDOV1wLKGBTLdv8tDFJ usSoDrIkrl8lItpz1+I3iaRbE2LLhkeZMwhBepMzqG0b7gtGO1oOtZvVOiKF7yVzvifRmT 8pS4ouDekDoaLBz+Zc0UwcG4c+6c+8df/pKPh1azgPv//sWMIxhMwYxYCc92XSvj5wM205 pOVnN8cObUiuYYcqFCzI8UuqZqZeZPgfh0LzBn/ZhsfFyLBT+V83IacpD4R2tQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1748807647; a=rsa-sha256; cv=none; b=uR4549NGEsACESgt5GXZpemNBR/KftjVwJcBi1FkrvbbPaUrC5XSZAgqKwiIu8dJL6MFLi TwRRE1cI7kbeLDowkJuCJumNeIVQqD/ztk8qkMf1LjWD3a2OwGXGWxazp6gzdGPYDRjF51 J9QfJdaAu98TWkz/SJiknOkClwXDkMy2dW+IOkfHJRPTxVHVQGoN7cOmjSQQVvnlE1x0Ff 1q3y6+Np3OL7rRMyIJCiKJ8szSURQjmlEtWq79adPbNRy17z1EQXaJDFFL0nPvD1rc+RCB mbCXKK1OxprGIAd6Dccv0zX151r/aBhzEM8q0xxu0AIHdOBzuh8Qzqajflb6sg== 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 4b9SNG6FY4zdTc; Sun, 01 Jun 2025 19:54:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 551Js6AV046255; Sun, 1 Jun 2025 19:54:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 551Js6G3046252; Sun, 1 Jun 2025 19:54:06 GMT (envelope-from git) Date: Sun, 1 Jun 2025 19:54:06 GMT Message-Id: <202506011954.551Js6G3046252@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: f00a7faf0503 - stable/14 - sysrc: Fix check flag logic for append and subtract 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f00a7faf050370d77292cac4c622a5a8d98ab13d Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f00a7faf050370d77292cac4c622a5a8d98ab13d commit f00a7faf050370d77292cac4c622a5a8d98ab13d Author: Michal Scigocki AuthorDate: 2025-04-14 07:01:06 +0000 Commit: Mark Johnston CommitDate: 2025-06-01 19:53:29 +0000 sysrc: Fix check flag logic for append and subtract When using sysrc with the check flag (-c), the append (+=) and subtract (-=) operations result in incorrect return values because on the check path the necessary union/difference calculation logic is not performed. However, the correct union/difference calculation is already performed when running without the check flag. We fix the issue on the check path by using the results from the existing union/difference calculation in the check logic to get the correct return values. PR: 279200 Reviewed by: markj MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/1664 (cherry picked from commit c97460c4d97db1bd46dab9f2bdbc90cd1ed7757f) --- usr.sbin/sysrc/sysrc | 52 +++++++++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/usr.sbin/sysrc/sysrc b/usr.sbin/sysrc/sysrc index 1766cf7ab835..625ff5ca4efd 100644 --- a/usr.sbin/sysrc/sysrc +++ b/usr.sbin/sysrc/sysrc @@ -764,33 +764,6 @@ while [ $# -gt 0 ]; do continue fi - # - # If `-c' is passed, simply compare and move on - # - if [ "$CHECK_ONLY" ]; then - if ! IGNORED=$( f_sysrc_get "$NAME?" ); then - status=$FAILURE - [ "$VERBOSE" ] && - echo "$NAME: not currently set" - shift 1 - continue - fi - value=$( f_sysrc_get "$NAME" ) - if [ "$value" != "${1#*=}" ]; then - status=$FAILURE - if [ "$VERBOSE" ]; then - echo -n "$( f_sysrc_find "$NAME" ): " - echo -n "$NAME: would change from " - echo "\`$value' to \`${1#*=}'" - fi - elif [ "$VERBOSE" ]; then - echo -n "$( f_sysrc_find "$NAME" ): " - echo "$NAME: already set to \`$value'" - fi - shift 1 - continue - fi - # # Determine both `before' value and appropriate `new' value # @@ -848,6 +821,31 @@ while [ $# -gt 0 ]; do new="${1#*=}" esac + # + # If `-c' is passed, simply compare and move on + # + if [ "$CHECK_ONLY" ]; then + if ! IGNORED=$( f_sysrc_get "$NAME?" ); then + status=$FAILURE + [ "$VERBOSE" ] && + echo "$NAME: not currently set" + shift 1 + continue + elif [ "$new" != "$before" ]; then + status=$FAILURE + if [ "$VERBOSE" ]; then + echo -n "$( f_sysrc_find "$NAME" ): " + echo -n "$NAME: would change from " + echo "\`$before' to \`$new'" + fi + elif [ "$VERBOSE" ]; then + echo -n "$( f_sysrc_find "$NAME" ): " + echo "$NAME: already set to \`$before'" + fi + shift 1 + continue + fi + # # If `-N' is passed, simplify the output #