[Bug 282714] /bin/sh doesn't report line numbers correctly when run with the PS4 environment variable
Date: Wed, 13 Nov 2024 14:38:36 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282714 Ed Maste <emaste@freebsd.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |emaste@freebsd.org --- Comment #1 from Ed Maste <emaste@freebsd.org> --- There's a reference to LINENO in PS4 in: commit 292e6676632a8c0ec58ba6a005d2478aa57e799d Author: Jilles Tjoelker <jilles@FreeBSD.org> Date: Thu Jun 9 23:12:23 2011 +0000 sh: Do parameter expansion before printing PS4 (set -x). The function name expandstr() and the general idea of doing this kind of expansion by treating the text as a here document without end marker is from dash. All variants of parameter expansion and arithmetic expansion also work (the latter is not required by POSIX but it does not take extra code and many other shells also allow it). Command substitution is prevented because I think it causes too much code to be re-entered (for example creating an unbounded recursion of trace lines). Unfortunately, our LINENO is somewhat crude, otherwise PS4='$LINENO+ ' would be quite useful. -- You are receiving this mail because: You are the assignee for the bug.