Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14316

Re: Number with sign is read as octal despite a leading 10#

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: Number with sign is read as octal despite a leading 10#
Date Tue, 10 Jul 2018 11:04:30 -0400
Lines 28
Approved bug-bash@gnu.org
Message-ID <mailman.3379.1531235084.1292.bug-bash@gnu.org> (permalink)
References <CA+n9pTy7vSPUA0j-bDF9_eWF0XysePRDAFckgvvHX8haSWv7KQ@mail.gmail.com> <5fda6745-9bea-b881-76f0-21f2488df229@case.edu>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1531235085 1235 208.118.235.17 (10 Jul 2018 15:04:45 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
Mail-Followup-To bug-bash@gnu.org
Content-Disposition inline
In-Reply-To <5fda6745-9bea-b881-76f0-21f2488df229@case.edu>
User-Agent NeoMutt/20170113 (1.7.2)
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy]
X-Received-From 139.137.100.1
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14316

Show key headers only | View raw


On Tue, Jul 10, 2018 at 11:00:36AM -0400, Chet Ramey wrote:
> On 7/9/18 9:24 PM, Isaac Marcos wrote:
> 
> > Bash Version: 4.4
> > Patch Level: 12
> > Release Status: release
> > 
> > Description:
> > A value inside an arithmetic expansion is processed as octal despite using
> > a 10# preffix.
> 
> An integer constant cannot contain a `+'.
> 
> > 
> > Repeat-By:
> >         $ echo $((10#+0034))
> >         28
> 
> If anything, this is bash being too liberal in accepting constants that
> begin with `base#'. There would be a good case for rejecting the `10#'
> because it's missing the value.

It also happens with negative values.  I wish the original poster had
shown that case as well.

wooledg:~$ n=-019; echo "$((10#$n))"
bash-5.0: 10#-019: value too great for base (error token is "019")

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Number with sign is read as octal despite a leading 10# Greg Wooledge <wooledg@eeg.ccf.org> - 2018-07-10 11:04 -0400

csiph-web