[Bug 235589] sh(1): LINENO is unset in shell arithmetic

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Mar 1 01:38:14 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235589

Paco Pascal <me at pacopascal.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #212048|0                           |1
        is obsolete|                            |

--- Comment #5 from Paco Pascal <me at pacopascal.com> ---
Created attachment 212062
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=212062&action=edit
Perfect LINENO behavior?

This patch is the same as the last one I posted, except it asserts that LINENO
can't be 0 and LINENO in functions were off by 1. In the previous patch I
posted,

    echo `
    echo $LINENO`

would output 0. There might be a better method of ensuring this than what I did
in parser.c.

As far as I can see, this makes LINENO behave in every way it should. The
following,

    echo $LINENO $((LINENO)) $(($LINENO))
    PS4='$LINENO+ '
    echo `echo $LINENO`
    eval 'echo $LINENO $((LINENO)) $(($LINENO))'

all perform in what I think is expected ways.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the freebsd-bugs mailing list