Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Feb 2019 23:01:32 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 235589] sh(1): LINENO is always 0 in shell arithmetic
Message-ID:  <bug-235589-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D235589

            Bug ID: 235589
           Summary: sh(1): LINENO is always 0 in shell arithmetic
           Product: Base System
           Version: 12.0-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: mcdutchie@hotmail.com

In sh(1), the LINENO variable (currently executed line number) is always ze=
ro
when it is read as part of a shell arithmetic expression.

For instance:

$ echo $LINENO $((LINENO)) $(($LINENO))
108 0 108

Expected: 3 times "108" (or whatever the current line number is)

Note that $(($LINENO)) does work because it expands LINENO as a normal shell
expansion before invoking the arithmetic subsystem. However, $((LINENO)) sh=
ould
be equivalent as it is for all other variables.

Another manifestation of the bug is:

$ set -u
$ echo $((LINENO))
-sh: arithmetic expression: variable not set: "LINENO"

--=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>