Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Isaac Marcos Newsgroups: gnu.bash.bug Subject: Re: Number with sign is read as octal despite a leading 10# Date: Sun, 12 Aug 2018 03:37:31 -0400 Lines: 92 Approved: bug-bash@gnu.org Message-ID: References: <71850c03-54d3-6a7e-1d29-136950d9e139@iki.fi> <471822f3-4484-59b5-0433-fc394dc9b34a@case.edu> <709908e4-693e-3d91-3920-e91843c13f9d@case.edu> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1534059478 23105 208.118.235.17 (12 Aug 2018 07:37:58 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash , bash@packages.debian.org To: Chet Ramey Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=p/GIVcfhHjw+Tp4sR1bP4FpCIQPlq4ZRNBYxcmUSCMw=; b=IsIFOCDCpaDKl+4s/ye7AYtoY48wAon11/fbk+Yu9c0vkqHknZ24IXbbKxzeCFDMP9 3YMapl2bqYcPYDZGu8077u06apmFJLiDbmwn0DiFgqqf+L8qDEdG/f57qlOJ91bnAnml vCSSMJp5X7n58dqJ7za+X3MLGRrO2aW1tTiCHrdjt0VoAy1c3A1TeLD7MQMlRQ5Zj/ay WQB2DYtl4Uvejb6FzDvdXX4BedZEbRym7NVQerTrLgWhjbGeHwxHIV6OsNqj3O4DPhEu OLpCBwhM97uDdiuFzcs3NaPWpy+LAN59evlcq37OP6LUoClpq8/1KexuOkX4pUzCyYHm F1Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=p/GIVcfhHjw+Tp4sR1bP4FpCIQPlq4ZRNBYxcmUSCMw=; b=KRlAkKLOCznPBuzuOjryoDI/KKWPT28IDSkGrGVZalvXufWDv/Ntuh2bLuGv0/U7E/ q2VY6VXsM1Y7pXyeaDC9HerYeSCYmes1IS/4uvnj36zsrvlQqhnUopQgdWYQSc2j14UY xq6fhE0kTaOC58H5a4CuWXRXyBdxariWYBOJ1UnMuwYNXsZOPNtL/qe/GLQ2GSfJ8zRj 73Af8xHxCarc7x2VysElvRq1q5cHQ5nzUK+ic+1rS7VsPtBJowSJIpb2dLmE5Fz8NDa7 hMPoSYgDfdZ0Zorjk+86E7X1P52K5oiQ6zVhhgPFRyrJTXUt1s5j2GpnkiU6evP4iwXo E60Q== X-Gm-Message-State: AOUpUlGhAWxI8iPruhkz/VQdtJyQTE8DnOmia0k5wZ+QQm1w18XNHa9u e8Zt+3gU+nFqKeXY2Kv7RyhWCvxKys+tRL+u6EPNVmF9 X-Google-Smtp-Source: AA+uWPx3VVrrbhof2ij5I1qmXvggA4ro71Q1Cn1Ky7oiP7GsSsT9VQ67RRMniF/PS0Xv4YGJiw7zj8AZ1HQDBN9b5G8= X-Received: by 2002:a37:8883:: with SMTP id k125-v6mr11721414qkd.274.1534059472356; Sun, 12 Aug 2018 00:37:52 -0700 (PDT) In-Reply-To: <709908e4-693e-3d91-3920-e91843c13f9d@case.edu> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::231 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14468 Chet Ramey (>) wrote: > It doesn't matter. Unary plus and minus are operators, not part of integer constants. But you are confused, what is after the 10# is not an integer constant, it is an string. An string that is being parsed by bash C code and coerced into a sign operator and a string of digits. What causes the problem is that the sign breaks the effect of the 10#. But that is entirely the result of the chosen interpretation of the string. You claim that it should be as the c language does it. But that is in conflict with any common human interpretation, namely: A number is: An optional sign followed by one or more digits. If you don't want to agree then mark this bug as wont-fix. El mar., 10 jul. 2018 a las 23:31, Chet Ramey () escribi=C3=B3: > On 7/10/18 6:46 PM, Isaac Marcos wrote: > > 2018-07-10 18:12 GMT-04:00 Eduardo Bustamante > >: > > > > On Tue, Jul 10, 2018 at 1:57 PM, Isaac Marcos > > > > wrote: > > > Chet Ramey (>) > wrote: > > [..] > > > This is not a serious argument. > > [...] > > > I don't care. All other shells do this correctly. It makes you th= e > only one > > > wrong. > > > > > > This is not a serious discussion. > > > > Can you keep the discussion civil? > > > > > > No. > > > > > > I don't get why you feel compelled > > to qualify an argument from the main developer as "non serious". > > > > > > Because *he* qualified my comments as "non serious" in another email. > > I did. You wrote: > > "Are you saying that bash should reject the use of negative numbers? > And, If so, why bash does not raise an error? (as it is expected that it > must do on invalid input)." > > This is clearly a ridiculous strawman. > > The topic is whether or not a sign can appear in the middle of an integer > constant, even when that integer constant begins with the `base#' syntax. > > > Only bash prints 28. Why others can print 34 ? > > They extend the definition of an integer constant. It's perfectly > reasonable to do that. Bash sticks to the C definition. > > > > > What is odd in expecting that an string like `-00133` actually mean > `-133` > > in decimal? > > Why would that be reasonable? Integers beginning with `0' are octal > constants. > > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/ > --=20 Cases are always threesome: Best case, Worst case, and Just in case