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: Tue, 10 Jul 2018 18:46:32 -0400 Lines: 90 Approved: bug-bash@gnu.org Message-ID: References: <71850c03-54d3-6a7e-1d29-136950d9e139@iki.fi> <471822f3-4484-59b5-0433-fc394dc9b34a@case.edu> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: usenet.stanford.edu 1531262798 16119 208.118.235.17 (10 Jul 2018 22:46:38 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash , bash@packages.debian.org, Chet Ramey To: Eduardo Bustamante Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=W5yyE+oDI+jYytWX+5V9riEJFHCXuPOQy0st3JA7LH4=; b=vW0MMCcxFOTXFnSJWwAfm8ii3HWYBMHKhTy9/tend7DO+1ylKP4i2TpyAeHkRfaIhu HZLrJIbemPRSIp/JM/AuCXQH5Xzhyz12Z9QUwC/ja7PytqDSY/utuHnR5BuC/MucyPLK M1HNKJKz+FpvcO634oPw+Ay2xhqBu5Et0N7mxke0PhuCZaDBTgbTZkkgsrnBpq7N6tWn ICWfPbilGBwpVy4TOoA6l2QWVEadNWrnuJKgFo5CHSI2YxzSGCML8GrYofhgOauPQqCB EgpiLYVPETZM5SAc5u5TPW2X5m9s96yIbQnyW1rd3Qde99yh33qMTZr2M2kooNv0UGJE sATw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=W5yyE+oDI+jYytWX+5V9riEJFHCXuPOQy0st3JA7LH4=; b=Z8XuyiIWxYHP2a9fPrZ2GA85w/yinUn2kHyVvijSYyVAn+ppo4Rh0kEElb9DmDLd0q hbQwOtYbhfoTFxEDXKZ2jKzLDfZGuYw9KajBMkwUi+mAK4tnm5deYPwJz4BIxi/6Nl7Q GkkBfnvAlrHezqkdQYuOZZmSoPnqk/qEhvR5Mr5e12eu3nH+AJkBa/sGrOL2fn9OLLem psNki32VoM3k7XZugxnLFtvYmx9lOX2OatDs5gMeufLiIMxYh1FRiCTG1IhyYYHAnfI1 GF2DYMFUm+EaSzICH9Xwqdadqc16v3U5EmCmMqQi069rDQPPBKxmxbae+PDJ180Vd8sH oOKA== X-Gm-Message-State: APt69E3srL6eh3AZOcne0mpOsYt92JgIrQtdAoj/nvRaWyuwohnjTLCl /n1WDd1PGGGnhtty6DepYyRwUY6SNRaRPTDOuVg= X-Google-Smtp-Source: AAOMgpeHdBGvU+wRUOP2ML25HxRXJHqN/+ClQVuJj3C8wxKR1cHw8SP0Db+iWsuNfg85LNwdafFgEo6X87rsp5jZ6k8= X-Received: by 2002:a37:2711:: with SMTP id n17-v6mr15434172qkn.109.1531262793166; Tue, 10 Jul 2018 15:46:33 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::232 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:14324 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 the 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. > What's your definition of "correct"? Exactly what was posted on the fist post. That a `a=+0034; echo "$((10#$a))"' print 34 not 28. Try this(from some other e-mail I did send): set -- 34 034 0034 +34 +034 +0034 -34 -034 -0034 ; for i do printf '%6s' "$((10#$i))"; shift; done; echo 34 34 34 34 28 28 -34 -28 -28 # bash 34 34 34 34 28 28 -34 -28 -28 # posixbash 34 34 34 34 34 34 -34 -34 -34 # lksh 34 34 34 34 34 34 -34 -34 -34 # mksh 34 34 34 34 34 34 -34 -34 -34 # ksh93 34 34 34 34 34 34 -34 -34 -34 # attsh 34 34 34 34 34 34 -34 -34 -34 # zsh Only bash prints 28. Why others can print 34 ? According to Chet, the definition > is the same as the ISO C standard. I'm not sure if there's a public > version of the ISO C standard document, but > http://c0x.coding-guidelines.com/6.4.4.1.html seems to be good enough. > The definition of an "integer constant" in that document does not > include a sign. > That is a description of the inability (or unwillingness) to raise above c limitations. What is odd in expecting that an string like `-00133` actually mean `-133` in decimal? Even more if the shell is explicitly told to parse the string as decimal with the `10#'. > So, in that regard, Bash is behaving according to specification. > As is also according to specification (of c) that a string could not have a NUL byte but some shells raise above that limit and are able to reasonably use such values. But I don't care anymore. This is the way in which users are lost, and you have lost me. I'll just use some other shell. -- Cases are always threesome: Best case, Worst case, and Just in case