From nobody Sun May 29 09:36:07 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 F2F021B3A1B0 for ; Sun, 29 May 2022 09:36:07 +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 4L9thR5rrPz52fl for ; Sun, 29 May 2022 09:36:07 +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 A86B2206E3 for ; Sun, 29 May 2022 09:36:07 +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 24T9a72r033581 for ; Sun, 29 May 2022 09:36:07 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 24T9a7hS033580 for bugs@FreeBSD.org; Sun, 29 May 2022 09:36:07 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, 29 May 2022 09:36:07 +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: pstef@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: cc 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=1653816967; 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=famMbXaWa8893Fg/ne1hh2WNUwehgcSovV5Rk35lX+c=; b=q7y9KXZFQ+18ZwzqHla/nwpfxFWT0dWu8+PexM1Gkr8WRnJnu2dbsLKLpcIO7wzpTkaLxJ kChjo/7dSc+PsujH5MPbaSfD2HVfM3aEbOOphupixLg/x8iIdy1OcwzgIdRIsqQbhi7B6A 5l7ybIFFh1gRTC8pxu0j4XFojU645LLqzsm7KpycGdh973U4KFPmyGQnSwxQm87h4Uvm2m HYcdYoWNzCUVetiwqr4R0ZfSFG2CcM5PF3wqgZRT3fQphOEBMzWIPa0JTHfKaTPGOO7VYL /qZGalgZW7kJ2ZdFrtEHTV8+Ay0dLrWvI695VK8ORFMWzmajV2ZZcYbBVNuEOw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1653816967; a=rsa-sha256; cv=none; b=cwn5z+cXrlkkFbt/qErBvTdC73pC9AvjJucms2Nvpt2cUlAysWRRJYdgOa8tsAq6YUTV6m RiXbXpctC/O3JfuBxUT0ltAP4O+2jneiFcLGpOQZCma4nLQbdpOqMuXFRnOva4BXYSMc4Q 4e5xum/iuYLr179ZY1q8WvtAtAaRNZ95rFr9JIs+oic+IhThGECysJNWgxn3pIWU9Pbt0k 3K34a/PFnTselJuSzn0aKESBcE+rR6fb0yIKg6OIS+74rtWG90cgkFKs2Gf6mu0o+8uLw+ brV5rit3+AYLtvzdloZP06hKCk/Mb9xj/kIpwlz2KtNs9DnZNkAiAIXXQd+40w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D46441 Piotr Pawel Stefaniak changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pstef@freebsd.org --- Comment #13 from Piotr Pawel Stefaniak --- (In reply to Nathaniel Barragan from comment #11) I tried the naive approach to make the parser re-entrant by doing something like this static struct state { struct heredoc *heredoclist; /* list of here documents to read */ int doprompt; /* if set, prompt the user */ int needprompt; /* true if interactive and at start of line= */ int lasttoken; /* last token read */ int tokpushback; /* last token pushed back */ char *wordtext; /* text of last word returned by readtoken = */ int checkkwd; struct nodelist *backquotelist; union node *redirnode; struct heredoc *heredoc; int quoteflag; /* set if (part of) last token was quoted */ int startlinno; /* line # where last token started */ int funclinno; /* line # where the current function starte= d */ struct parser_temp *parser_temp; } states[2]; static size_t current; then referring to the fields in states[current] in place of the formerly fi= le scope identifiers, and also incrementing/decrementing current at the right times.=20 But I'm not exactly sure when those are. Also, there's the problem of expde= st invalidation on multiple calls to expandarg. --=20 You are receiving this mail because: You are the assignee for the bug.=