From nobody Mon May 30 22:10:58 2022 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 20B431B56BB9 for ; Mon, 30 May 2022 22:10:59 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LBqNy6XDhz4W5J for ; Mon, 30 May 2022 22:10:58 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) 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 C05C11F73E for ; Mon, 30 May 2022 22:10:58 +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 24UMAwfO017370 for ; Mon, 30 May 2022 22:10:58 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 24UMAwl0017369 for bugs@FreeBSD.org; Mon, 30 May 2022 22:10:58 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: Mon, 30 May 2022 22:10:58 +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: jilles@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? maintainer-feedback? mfc-stable13? mfc-stable12? X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1653948659; 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=4GrO+OjPIGo9xiWCqs3PfTYlzDlyLTW/FD2g6volbEE=; b=TyEbAaedLl7t83re/JTz+9E/cuy4IyefFiACEgabYnvEjlRXeK3OyODmSepC9V3dDYZg5S KisqnpK72ypgSf02W+CFQbuKZYIRnzs5F2mxSJki7tg4SdV8ILrDU+Du2GKjIW1LnbKuTe TRJ1S7uCGbtI2PPv5UGE84/EdC7gPO0sNu4/ef44Y353T+77irLl9FJmFHnGYGEia+d26j s98vejJgJJpDoM9R9uDIXnnBQHFgdemw55++c+NJspCQVJMLpKfO6L3G2jljoeMzAq6d7p aAwXI5JpUDbVbA764XM1QAJNshS8HDURJcYluR1Ima/AICZ4IF+FcHtfWeNkhA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1653948659; a=rsa-sha256; cv=none; b=EGr4GdCiSHJ3deQqoompFnoKf/hZb1HMMXs+Zir5uEsvnqMHZCtG+h2LQRQA7/VSdYSwJg bv4eWUnRwODhqOgzJJuSIR1B8g8ECoivltF/urcvmMkpCl5YGPzwBhsrl86PFplSXJY2Gn 54XXyjkE5/zxRq2fWDPjt2MJ9lncqyHLXLiSnMD4UGDufowoWDzQDSC+K6mUsDWaYVRvfP U3JfrFnfqyUsBkSlNCcMRr1arjwRF2BHc6pybWwXYUXUaXdLxLejoGwK9LzqsTkSQu6X6m kdEOzTcTox7m8OpgoQ9ioUWdyOT//80pevbNnVeXqHznyLWEoMnZR+UoWyhJpg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D46441 --- Comment #15 from Jilles Tjoelker --- (In reply to Piotr Pawel Stefaniak from comment #13) If you're creating a parser state struct, it may be better to pass a pointe= r to it to most functions in parser.c. The struct would be allocated on the stac= k in parsecmd(), parsewordexp() and expandstr(). This eliminates uncertainty abo= ut "which" parser state needs to be used. Due to pointers in the parser state that need to be freed, parsecmd() and parsewordexp() would need to use setjmp(). An alternative might be to keep = the parser state for those statically allocated; I don't think they are re-ente= red (eval and . are not among the builtins that can execute in a subshell witho= ut a fork). To avoid unlimited recursion via PS4 while still allowing command substitut= ion in expandstr(), it might work better to ignore xflag during an expandstr() invocation. --=20 You are receiving this mail because: You are the assignee for the bug.=