From nobody Sun Oct 12 19:27:34 2025 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 4cl9VH1BMFz6CPv8 for ; Sun, 12 Oct 2025 19:27:35 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cl9VG710qz3WgZ for ; Sun, 12 Oct 2025 19:27:34 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760297255; 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: in-reply-to:in-reply-to:references:references; bh=w0b+GuM6C1PGkNur2AYnpyaSL9hQedjnlgY7TrKNXhA=; b=kgfZu9EI2TcTtkVxlYeRms1wlsIbFeYRbx/StZBh0JOLvDH7TEaBQBlYp0usRaQ3DDjb+U edaVOqMW6LxRJ8y/yrF2L5T4smoHJ6WIMT8YJbvXwevlFCN+2PHwAHjVoLjPnE0RO9/tbV fxtyqgMILs2wJHOtlw0cIq30IiYEMYqjWwxFl5D4CAPZ61BcYyMJs6mtjLstrhTn/29lao k1qBZRuXAPdWSX87sIfCIVQA4ZWThexbk8zLsOOZSerEqeWE6eJFs/ugi8zjZC/Y3jNzSD NM0JlglkoTkqkIQdcFeuDpt+rpa9lVvcvU29tYSvuV8XCEabwLc2wb4gjGEjsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760297255; 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: in-reply-to:in-reply-to:references:references; bh=w0b+GuM6C1PGkNur2AYnpyaSL9hQedjnlgY7TrKNXhA=; b=sVnAO55bBhGN/9pH6YlAxoIqD0cmO9cA7uA71u18lZI1ymVfXvcDdiLK0Ip7MsW3Fhjw0k vPpc0bJK7Z2+FWZXxERX+mWRSjrAdqq2z0dmpeXuO4CEJl/gcB/7dwd2Fhfaro5YFDFEdh u5EueznxY+S+aiaKH5vN9nmCdKmJTPwS84xVgjXleDkQK0DLjrE9SiQN/p4iTg/W77WF3i cWdfc0WgFTPggI/Ah0SiZAoo4zzmEEMHeGuszAehyQTsKab0czuMv0KJMWnPdczj9GlO+F p3bldjOJIWqfj7MhHZM2jY9+LmkA8ShXi8s65FQaHsgqJSXHEH4RCFid9/bJzA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760297255; a=rsa-sha256; cv=none; b=NR222NgQOrFmYFuoIy7Wghvxfv6bYN+htN9QL/kyWi2equaqJcc9JOmmzTo0OeDPv5TCL+ jzoWQwWssddWosSBUis8ZxRoDnOxq62w0M3S2TzXuYP3nFxWrye8KNvQos47zsuVyPF5WX fr/eeDylpIgPiwEHijIkexxTRBHWNF9R+7ZP0M5wfm2A/vt2Ivrm7Nt/18Lg6fCD7NFzaG 4h4syWuukYTIftlDhPVjb4NUYG4mt+5zyb7bJpkgkkjQXijnBYXRb7deH8vmgvRu0m+z5T yCxjXsOqQY7LB8MEXlXXNJfdxp/vfO6/0UZOobG+BX8Vaebpdn7IC8HDK+X7Xw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cl9VG6KFRzZfD for ; Sun, 12 Oct 2025 19:27:34 +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 59CJRYgl047846 for ; Sun, 12 Oct 2025 19:27:34 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 59CJRYZ5047845 for bugs@FreeBSD.org; Sun, 12 Oct 2025 19:27:34 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 46441] sh(1): Does not support PS1, PS2, PS4 parameter expansion Date: Sun, 12 Oct 2025 19:27:34 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: feature, needs-patch, needs-qa, standards X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: matthew@matthewphillips.info X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? maintainer-feedback? X-Bugzilla-Changed-Fields: attachments.isobsolete flagtypes.name attachments.created Message-ID: In-Reply-To: References: 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 MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D46441 Matthew Phillips changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #264417|0 |1 is obsolete| | Attachment #264503| |maintainer-approval?(jilles Flags| |@FreeBSD.org) --- Comment #21 from Matthew Phillips --- Created attachment 264503 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D264503&action= =3Dedit PS1/PS2 parameter expansion patch v2 Uploaded revised patch (v2) that addresses the review feedback. As mentioned, this patch maintains the localized approach within getprompt() and avoids full parser reentry. While this means we don't support advanced expansions like ${parameter#pattern}, it provides POSIX-compliant basic parameter expansion without the complexity of making the parser reentrant. = This is sufficient for the vast majority of use cases and aligns with the existi= ng PS4 implementation strategy. The original patch claimed to support special parameters ($$, $?, $!, $#) a= nd positional parameters ($0-$9), but only called lookupvar() which cannot han= dle these parameter types. This has been fixed. Special parameters now properly implemented: - $$ =E2=86=92 rootpid - $? =E2=86=92 oexitstatus - $# =E2=86=92 shellparam.nparam - $! =E2=86=92 backgndpidval() Positional parameters now properly implemented: - $0 =E2=86=92 arg0 (shell name) - $1-$9 =E2=86=92 shellparam.p[num-1] Added tests as well: - ps1-expand1.0: Regular variable expansion ($testvar) - ps1-expand2.0: Braced variable expansion (${testvar}) - ps1-expand3.0: Special parameter $$ (PID) - ps1-expand4.0: Special parameter $? (exit status) - ps1-expand5.0: Positional parameter $0 (shell name) - ps2-expand1.0: PS2 continuation prompt expansion --=20 You are receiving this mail because: You are the assignee for the bug.=