From nobody Sun Jun 14 12:18:28 2026 X-Original-To: bugs@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 4gdXN45yTlz6j4H8 for ; Sun, 14 Jun 2026 12:18:28 +0000 (UTC) (envelope-from bugzilla-noreply@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" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gdXN44trjz3PbC for ; Sun, 14 Jun 2026 12:18:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781439508; 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=8oDwqj5nwfoAP8ifDOyN8O9+qKm135CaQNi7NqWChUE=; b=JaKFxrkMHTMRvSY14ioee9eZpDGhUU0ArUG+fno/7ZbglO7orYASRrbrtLGCE8XzI+4n6J sTBmVaaX0iOtz/n90nhQYoKHb8XjuQ9FkZFkWdvgdq+X+J08sL+vp4/V+iokGQ4foZFTcX 7rWrwN+pF41c29FW8ltQlTiMwmeF/FZBqmMGvZ+cOdpyUSKDXlmVyIO7pvCmYtPntGQUnZ Fnf2mEJF/v7uc8xg4ZUi2EfZGFDMwDW7+nkNkCNr6rYXrrJr8G3y05pPuP80CxA38fEsg6 3HzAdNN8WUFP+FqfxrfBr8ihn3nhqNwjoShQWhL5zImbLp2+vobi4FpjrRN+Bw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781439508; a=rsa-sha256; cv=none; b=rOwisntclp3D9WPVu6Gkw2FVckb4Wx3gODnuM4o8RrnmY2QdUSX6t3WH0fvjiO9Zi4oebQ /9ZcPN4EVG4K9LO2jKSfelB8k8UgNi7GVzOsxH67sG9ka1W6m0h/mbFTyo0R10DEvS1rDe XeMs+bY6ziz0GzBAo2oqrokMSTyrij8oKvNbPhgrdQR0kdCTgDRbw6LBsMVCBwXs5Q7KEo q1zmj7xjg75SYUXnOJXwjFUrsNG6btpwzA3EMzaYEEgOdX4zzKHNEfHRwPWRd5S42hWAA2 JA8wFU69V3CKc+dEA0KmZep5HCPSFS8II5umz+4TAYN6jLQ+W3arH0m1FQ5gDw== 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=1781439508; 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=8oDwqj5nwfoAP8ifDOyN8O9+qKm135CaQNi7NqWChUE=; b=A1dvR8zgIp4VHU8+Xo8CzyVhr/gkMtLQklol6yICZ7jdb1rbsJSLG9M42jgkSh0YgFNxUd jO8fPT7g8DOim95POqocmPNcTfV/RDtYkr+pmLUkp771EPRfKddgL+CE1hM2vp1Hy+eb67 nuOnO6gnZEE2z0PkUczFZ41CQtlTeAgjS0jop+96PpywRAGQs5Mr5mY00hykw6SLtaEnyZ GIy7pawHu1szgOoavgy3A+Q1Ngw1Js5LMKCiQlvRcHHgiy6OasMyXgwFoRD7XG/gpWsShK 3zxfH3Y37b1B8MiK4kAg1/Ipk+BdoB1RGsJkhQT0z/yieul/cVzIUICWHiHFqw== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4gdXN44DHqz17VB for ; Sun, 14 Jun 2026 12:18:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 65ECISUS061791 for ; Sun, 14 Jun 2026 12:18:28 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 65ECIS1A061790 for bugs@FreeBSD.org; Sun, 14 Jun 2026 12:18:28 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 296050] sh.1: Description of 'local' is not very clear Date: Sun, 14 Jun 2026 12:18:28 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Documentation X-Bugzilla-Component: Manual Pages X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: temcbun@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter cc Message-ID: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D296050 Bug ID: 296050 Summary: sh.1: Description of 'local' is not very clear Product: Documentation Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: Manual Pages Assignee: bugs@FreeBSD.org Reporter: temcbun@gmail.com CC: doc@FreeBSD.org The sh(1) man page says: "Variables may be declared to be local to a function by using the local command. This should appear as the first statement of a function, and the syntax is: ..." The part that I personally feel confused about is: "This should appear as t= he first statement of a function" - it seems that in practice this is not the case. I created a test shell script to check this out: ----------------------------------------------------- #!/bin/sh a=3D"Val 1" foo() { a=3D"Val 3" echo "foo(): a before: ${a}" local a=3D"Val 2" echo "foo(): a after: ${a}" } echo "a before: ${a}" foo echo "a after: ${a}" ----------------------------------------------------- Here I intentionally made 'local' line not the first function statement, but from the output of the script I can draw that the 'local' keyword still wor= ks as it should, i.e. keeps a variable local to the function. Output of the script follows: ----------------------------------------------------- a before: Val 1 foo(): a before: Val 3 foo(): a after: Val 2 a after: Val 3 ----------------------------------------------------- Please, let me know whether it is a bug in the manual page (the implementat= ion behaviour is correct, but the documentation is not), or it is a bug in the implementation (the 'local' shouldn't work if it's not a first function statement), or it is me who interpreted things the wrong way. --=20 You are receiving this mail because: You are the assignee for the bug.=