[Bug 46441] sh(1): Does not support PS1, PS2, PS4 parameter expansion
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 30 May 2022 22:10:58 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=46441 --- Comment #15 from Jilles Tjoelker <jilles@FreeBSD.org> --- (In reply to Piotr Pawel Stefaniak from comment #13) If you're creating a parser state struct, it may be better to pass a pointer to it to most functions in parser.c. The struct would be allocated on the stack in parsecmd(), parsewordexp() and expandstr(). This eliminates uncertainty about "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-entered (eval and . are not among the builtins that can execute in a subshell without a fork). To avoid unlimited recursion via PS4 while still allowing command substitution in expandstr(), it might work better to ignore xflag during an expandstr() invocation. -- You are receiving this mail because: You are on the CC list for the bug.