Date: Sun, 08 Sep 2019 21:29:42 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 235589] sh(1): LINENO is unset in shell arithmetic Message-ID: <bug-235589-227-0FsZzrUEqg@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-235589-227@https.bugs.freebsd.org/bugzilla/> References: <bug-235589-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D235589 --- Comment #3 from Jilles Tjoelker <jilles@FreeBSD.org> --- I like that this does not slow down the main execution loop much, since it = only does the conversion from integer to string when LINENO is referenced. This part could be slightly less magic by making a fixed struct var for LIN= ENO (like HISTSIZE, IFS, MAIL, MAILPATH, etc.). This fixed struct can also poin= t to a sufficiently large buffer "LINENO=3D1\0\0\0\0\0\0\0\0\0\0". I would like to see this new mechanism used instead of the old VSLINENO mechanism (so there aren't two separate mechanisms for $LINENO and $((LINENO))). Given that this will subtly change LINENO values anyway (try expanding LINE= NO twice in different lines of a word spanning multiple lines), I think it wou= ld make more sense to make it more like other shells do, reading the line numb= er at the start of a command containing expansions (NCMD/NCASE/NFOR). With this, it should be possible to set PS4=3D'$LINENO+ ' and see the scrip= t's line numbers in set -x output. You can compare https://git.kernel.org/pub/scm/utils/dash/dash.git/commit/?id=3D5bb39bb1995= cb12d8da76b1d482df9be1acc2eb4 which is a similar implementation for dash (another Almquist variant) but I don't think there will be much benefit in copying code from there. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-235589-227-0FsZzrUEqg>