From nobody Mon Feb 16 17:24:12 2026 X-Original-To: dev-commits-src-main@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 4fF8lJ3rLmz6S4s4 for ; Mon, 16 Feb 2026 17:24:12 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fF8lJ3DYzz3RM0 for ; Mon, 16 Feb 2026 17:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771262652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wlumUAIcnlZ0deaLopdYUn3kvOcUpFt3wNdZZfPH4So=; b=d18GW+ApRq+zMNwNOAyxCt/OBIsppTUTb6SXZRxa6bUAHa1OBgfcpw1IxexyoiK53Sxeon IHSHex0PI0mUg5NE6bHRGT8xOPH7B3+9A5Lzy0Jm81TBlSZrmIbEFM9qaVOXWhTeusvtdp UUaG6Oug7WB77Gt0vmU2x53YavMJ90Kc4aGdCdhvTYHIN20NGMgbOJdDqeHQPW0Ze343uw VSyIxd+g/2aOAdLJDJawMASUHh7OCjg72L2qrNB3RW4HD/6jidjZAHgtQcTBmvfpvF2JyT hoonEgPUmDSokKkvBElZpK1eQZX/M/viiAw5CrzXC2lOQQJdNZMW4g47nt/grQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1771262652; a=rsa-sha256; cv=none; b=swoqOvbauy1vl536DapIYJHSamgQHqrbvNw/FjjnydubR6fQYqfiMLcbl8lSDt18tDHWOZ nb/9Snn4vN7/s6eAQ1U8sDQb1wr6unjrCpCgkJVhTccjJBe4hAOI8Y7lmKpuOMo/Nz+oQq R4HTMREifr1pCH5yODSWtEZp82zNdvWk6ocxCJWnPwSpIhQT7JOuG13e4Hra0j5reLGoYf S7l7YTChQA1ZpOLKG9IT4KZqinvWFuKas1qUM7bq9bbQb3AxrAOlla7GeUMNVbmnMm/PH/ 3MGgnn9l9hFDUo6FXDxJNQtXdPQSBrRSqyAYD8FkGwyUVAJOoLgbBLGX2u+NjA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771262652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wlumUAIcnlZ0deaLopdYUn3kvOcUpFt3wNdZZfPH4So=; b=ErGV+9XnU8ZR9VWJWhf/XPP2fzidJv96og9elyaND1Dwg0U5+Agu80f7IFLuu9frqhRS7j a+olIodTfYdz/7Vs7Ou6SME69Te6cWm0AVyvAFfICFT+igis+AHPN9thJ8+zth9/F+dzCJ 7ul5bQ/N7HU+NLovoMOys4oBnLaMyhaTpIgfcMz9TeOzDQyWoiC80uo4atXxwDdTXvs/hH zi5VqzyMMzfc5vWBMD7lHouFTqGr/qUhAZvfRZIbLLJ+ihjnY8MOZgTiQhy901yncrSgJV r1Pf2vCsgCiw57/SXwG2Ud3+SOXf5sTWwaz7PaVBnJwpMu2GaVmgJcifsZYmeQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fF8lJ2mDyzZ7Y for ; Mon, 16 Feb 2026 17:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3268f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 16 Feb 2026 17:24:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Artem Bunichev From: Alexander Ziaee Subject: git: 931d4f0ae4f2 - main - sh.1: Document the exit status of return List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 931d4f0ae4f2dcd088bb92459ff19c8b6aafc2cc Auto-Submitted: auto-generated Date: Mon, 16 Feb 2026 17:24:12 +0000 Message-Id: <699352bc.3268f.48ff4fd@gitrepo.freebsd.org> The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=931d4f0ae4f2dcd088bb92459ff19c8b6aafc2cc commit 931d4f0ae4f2dcd088bb92459ff19c8b6aafc2cc Author: Artem Bunichev AuthorDate: 2026-02-16 17:14:00 +0000 Commit: Alexander Ziaee CommitDate: 2026-02-16 17:19:40 +0000 sh.1: Document the exit status of return It's not obvious that if `exitstatus` is omitted, the exit status of the function is taken from the last executed command. MFC after: 3 days Reviewed by: jilles, ziaee Differential Revision: https://reviews.freebsd.org/D55026 --- bin/sh/sh.1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/sh/sh.1 b/bin/sh/sh.1 index 3113c1cf6166..f4340fab6cdc 100644 --- a/bin/sh/sh.1 +++ b/bin/sh/sh.1 @@ -41,7 +41,7 @@ .\" the referee document. The original Standard can be obtained online at .\" http://www.opengroup.org/unix/online.html. .\" -.Dd February 3, 2026 +.Dd February 9, 2026 .Dt SH 1 .Os .Sh NAME @@ -1223,6 +1223,10 @@ It terminates the current executional scope, returning from the closest nested function or sourced script; if no function or sourced script is being executed, it exits the shell instance. +If +.Ar exitstatus +is specified, the exit status is set to its value, +otherwise it is set to the exit status of the last executed command. The .Ic return command is implemented as a special built-in command.