git: b5f6beefa00a - main - rc.subr: ensure run_rc_script return code is not masked by DebugOff
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 10 Sep 2024 19:00:50 UTC
The branch main has been updated by rcm: URL: https://cgit.FreeBSD.org/src/commit/?id=b5f6beefa00abf9ef51d4c53563f46c5a388a18e commit b5f6beefa00abf9ef51d4c53563f46c5a388a18e Author: R. Christian McDonald <rcm@FreeBSD.org> AuthorDate: 2024-09-10 15:58:57 +0000 Commit: R. Christian McDonald <rcm@FreeBSD.org> CommitDate: 2024-09-10 18:58:47 +0000 rc.subr: ensure run_rc_script return code is not masked by DebugOff Ensure that run_rc_script returns the true return code of the rc command and not the return code of DebugOff Reviewed by: sjg Approved by: kp MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D46626 --- libexec/rc/rc.subr | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr index 145b626aa01e..4bb2333addc2 100644 --- a/libexec/rc/rc.subr +++ b/libexec/rc/rc.subr @@ -1844,7 +1844,7 @@ run_rc_script() trap "echo Script $_file running >&2" 29 set $_arg; . $_file ) fi - DebugOff $_file $_file:$_arg rc:${_file##*/} rc:${_file##*/}:$_arg ${_file##*/} ${_file##*/}:$_arg + DebugOff rc=$? $_file $_file:$_arg rc:${_file##*/} rc:${_file##*/}:$_arg ${_file##*/} ${_file##*/}:$_arg fi ;; esac @@ -2769,7 +2769,18 @@ $_DEBUG_SH vdot /libexec/debug.sh # safe_eval.sh are not found. if ! have DebugOn; then DebugOn() { return 0; } - DebugOff() { return 0; } + DebugOff() { + local _rc=0 + while : + do + case "$1" in + -[eo]) shift;; # ignore it + rc=*) eval "_$1"; shift;; + *) break;; + esac + done + return $_rc + } fi if ! have save_dot; then safe_dot() { dot "$@"; }