Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #324: Your packets were eaten by the terminator


comp / comp.unix.shell / Re: The "leading zero means octal" thing...

SubjectAuthor
* The "leading zero means octal" thing...Kenny McCormack
+* Re: The "leading zero means octal" thing...Janis Papanagnou
|`- Re: The "leading zero means octal" thing...Kenny McCormack
+* Re: The "leading zero means octal" thing...Rich
|`- Re: The "leading zero means octal" thing...Kenny McCormack
+* Re: The "leading zero means octal" thing...Eli the Bearded
|`* Re: The "leading zero means octal" thing...Kenny McCormack
| `* Re: The "leading zero means octal" thing...Kenny McCormack
|  +- 'nf' in VIM (Was: The "leading zero means octal" thing...)Kenny McCormack
|  `- Re: The "leading zero means octal" thing...Janis Papanagnou
+- Re: The "leading zero means octal" thing...Joe Makowiec
+* Re: The "leading zero means octal" thing...saito
|`- Re: The "leading zero means octal" thing...Kenny McCormack
`- Re: The "leading zero means octal" thing...Eric Pozharski

1
Subject: The "leading zero means octal" thing...
From: Kenny McCormack
Newsgroups: comp.lang.tcl, comp.unix.shell, comp.editors
Organization: The official candy of the new Millennium
Date: Sat, 4 Jan 2025 22:14 UTC
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.tcl,comp.unix.shell,comp.editors
Subject: The "leading zero means octal" thing...
Date: Sat, 4 Jan 2025 22:14:19 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <vlcbrr$2ito3$1@news.xmission.com>
Injection-Date: Sat, 4 Jan 2025 22:14:19 -0000 (UTC)
Newsgroups: comp.lang.tcl,comp.unix.shell,comp.editors
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="2717443"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
View all headers

Subject: The "leading zero means octal" thing...
First of all, yes, I know this is all standardized and it is based on
legacy C conventions and it can't be changed and so on and so forth.

But if not a bug, it is certainly a misfeature.

I am referring, of course, to the convention that a number with a leading
zero is interpreted as octal. I can't count the number of times I've been
Date: Sat, 4 Jan 2025 22:14:19 -0000 (UTC)
bitten by this - in various languages/environments all across the Unix
ecosystem. Note the choice of newsgroups above - I have been affected by
this in each of these environments - most recently in Tcl (Expect) and in
the VIM editor.

In fact, the really obnoxious part about it is that it means a number
Organization: The official candy of the new Millennium
Message-ID: <vlcbrr$2ito3$1@news.xmission.com>
Injection-Date: Sat, 4 Jan 2025 22:14:19 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
string like "08" is invalid, because 8 is not a valid digit in octal. I
wish there was a global way to turn this off - some option to set that says
"Don't do that!". I realize, of course, that it has to be on by default,
but it should be possible to turn it off.

logging-data="2717443"; mail-complaints-to="abuse@xmission.com"
Incidentally, and this was my motivation for posting this rant, I hit this
in VIM - where if the cursor is sitting on the zero in a string like Foo07
and you hit ^A, it changes it to - are you ready? - not Foo08, but Foo010.

X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Totally weird and unexpected.

--
Just like Donald Trump today, Jesus Christ had a Messiah complex.
Originator: gazelle@shell.xmission.com (Kenny McCormack)

And, in fact, the similarities between the two figures are quite striking.
For example, both have a ragtag band of followers, whose faith cannot be shaken.
. Xref: unconfigured comp.lang.tcl:1251 comp.unix.shell:996 comp.editors:139

First of all, yes, I know this is all standardized and it is based on
legacy C conventions and it can't be changed and so on and so forth.

Subject: Re: The "leading zero means octal" thing...
From: Janis Papanagnou
Newsgroups: comp.lang.tcl, comp.unix.shell, comp.editors
Organization: A noiseless patient Spider
Date: Sat, 4 Jan 2025 22:54 UTC
References: 1
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.tcl,comp.unix.shell,comp.editors
Subject: Re: The "leading zero means octal" thing...
Date: Sat, 4 Jan 2025 23:54:15 +0100
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <vlce6p$lk3q$1@dont-email.me>
References: <vlcbrr$2ito3$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 04 Jan 2025 23:54:18 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2bdc7bee47d59c4498da5f7fc89dd24e";
logging-data="708730"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/rNxgJr/pBwTqlKNM7Zz0C"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:qabUaDi9pgjA9PWZJ7rSrnghvVE=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <vlcbrr$2ito3$1@news.xmission.com>
View all headers

On 04.01.2025 23:14, Kenny McCormack wrote:
> First of all, yes, I know this is all standardized and it is based on
> legacy C conventions and it can't be changed and so on and so forth.
>
> But if not a bug, it is certainly a misfeature.
>
> I am referring, of course, to the convention that a number with a leading
> zero is interpreted as octal. I can't count the number of times I've been
> bitten by this - in various languages/environments all across the Unix
> ecosystem. Note the choice of newsgroups above - I have been affected by
> this in each of these environments - most recently in Tcl (Expect) and in
> the VIM editor.
>
> In fact, the really obnoxious part about it is that it means a number
> string like "08" is invalid, because 8 is not a valid digit in octal. I
> wish there was a global way to turn this off - some option to set that says
> "Don't do that!". I realize, of course, that it has to be on by default,
> but it should be possible to turn it off.
>
> Incidentally, and this was my motivation for posting this rant, I hit this
> in VIM - where if the cursor is sitting on the zero in a string like Foo07
> and you hit ^A, it changes it to - are you ready? - not Foo08, but Foo010.
>
> Totally weird and unexpected.

Yes.

(You can find this complaint also already mentioned on the Web
in 2012, maybe even before. I suppose it's hard to do or change
anything as default behavior now.)

As a consequence, in Kornshell, I'm using a number prefix 10# to
counter that misbehavior. (I'd suppose this works also in other
major shells like Bash.)

In Vim there's a "sensible.vim" plugin available. (But I've not
tried it.) Given the tons of options in Vim I wonder why they
haven't supported an option to fix it inherently.

Janis

Subject: Re: The "leading zero means octal" thing...
From: Rich
Newsgroups: comp.lang.tcl, comp.unix.shell, comp.editors
Organization: A noiseless patient Spider
Date: Sun, 5 Jan 2025 00:09 UTC
References: 1
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl,comp.unix.shell,comp.editors
Subject: Re: The "leading zero means octal" thing...
Date: Sun, 5 Jan 2025 00:09:41 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <vlcik4$md8n$1@dont-email.me>
References: <vlcbrr$2ito3$1@news.xmission.com>
Injection-Date: Sun, 05 Jan 2025 01:10:11 +0100 (CET)
Injection-Info: dont-email.me; posting-host="8484d18e4d87a7d264be721074b3dc02";
logging-data="734487"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX198pu+buf/v1Tk5VYRLOrQ7"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Cancel-Lock: sha1:A3uN1kPIY8azRDskwLbzAsuYk7w=
View all headers

In comp.lang.tcl Kenny McCormack <gazelle@shell.xmission.com> wrote:
> I am referring, of course, to the convention that a number with a
> leading zero is interpreted as octal. ... most recently in Tcl
> (Expect) ...

For Tcl 9, leading zero decimal number strings are no longer
interpreted as octal:

https://www.tcl-lang.com/software/tcltk/9.0.html

Numbers

0NNN format is no longer octal interpretation. Use 0oNNN

Subject: Re: The "leading zero means octal" thing...
From: Eli the Bearded
Newsgroups: comp.lang.tcl, comp.unix.shell, comp.editors
Organization: Some absurd concept
Date: Sun, 5 Jan 2025 01:55 UTC
References: 1
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!panix!.POSTED.panix5.panix.com!qz!not-for-mail
From: *@eli.users.panix.com (Eli the Bearded)
Newsgroups: comp.lang.tcl,comp.unix.shell,comp.editors
Subject: Re: The "leading zero means octal" thing...
Date: Sun, 5 Jan 2025 01:55:17 -0000 (UTC)
Organization: Some absurd concept
Message-ID: <eli$2501042055@qaz.wtf>
References: <vlcbrr$2ito3$1@news.xmission.com>
Injection-Date: Sun, 5 Jan 2025 01:55:17 -0000 (UTC)
Injection-Info: reader2.panix.com; posting-host="panix5.panix.com:166.84.1.5";
logging-data="2192"; mail-complaints-to="abuse@panix.com"
User-Agent: Vectrex rn 2.1 (beta)
X-Liz: It's actually happened, the entire Internet is a massive game of Redcode
X-Motto: "Erosion of rights never seems to reverse itself." -- kenny@panix
X-US-Congress: Moronic Fucks.
X-Attribution: EtB
XFrom: is a real address
Encrypted: double rot-13
View all headers

In comp.unix.shell, Kenny McCormack <gazelle@shell.xmission.com> wrote:
> First of all, yes, I know this is all standardized and it is based on
> legacy C conventions and it can't be changed and so on and so forth.
>
> But if not a bug, it is certainly a misfeature.

I can see it as a legacy feature that has grown so old as to be a
misfeature. Other than bit patterns for chmod, I never see octal used
for modern stuff.

> the VIM editor.

Vim is highly configurable. See ":help nrformats" for supported formats.
Not clearly documented in the version I have, but implied, is setting
it to a blank string to only recognize ordinary decimal numbers.

:set nrformats=

If you have no vimrc, the defaults.vim shipped with the editor (vim 8)
sets that to recognize decimal, binary ("0b10101"), and hexadecimal
("0xcafe"). But the compiled in default also includes the dreaded
octal.

You might want to peruse the defaults.vim file for modern recommended
defaults. Except for scrolloff and incsearch, I don't find them that
unpleasant. I think a lot of people like incsearch, and I like scrolloff
on occaison, but not regularly.

Start vim, then ":e $VIMRUNTIME/defaults.vim" to view the defaults file.

Elijah
------
prefers vim acting mostly "compatible"

Subject: Re: The "leading zero means octal" thing...
From: Kenny McCormack
Newsgroups: comp.lang.tcl, comp.unix.shell, comp.editors
Organization: The official candy of the new Millennium
Date: Sun, 5 Jan 2025 05:16 UTC
References: 1 2
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.tcl,comp.unix.shell,comp.editors
Subject: Re: The "leading zero means octal" thing...
Date: Sun, 5 Jan 2025 05:16:50 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <vld4k2$2jao9$1@news.xmission.com>
References: <vlcbrr$2ito3$1@news.xmission.com> <eli$2501042055@qaz.wtf>
Injection-Date: Sun, 5 Jan 2025 05:16:50 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="2730761"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
View all headers

In article <eli$2501042055@qaz.wtf>,
Eli the Bearded <*@eli.users.panix.com> wrote:
....
>Vim is highly configurable. See ":help nrformats" for supported formats.
>Not clearly documented in the version I have, but implied, is setting
>it to a blank string to only recognize ordinary decimal numbers.
>
> :set nrformats=

Thanks for the tip. I'll look into that.

(And note, yes, this interchange between you & me is one of those rare
examples of Usenet working as intended. It gladdens the eye. It makes it
all worthwhile...)

--
The plural of "anecdote" is _not_ "data".

Subject: Re: The "leading zero means octal" thing...
From: Kenny McCormack
Newsgroups: comp.lang.tcl, comp.unix.shell, comp.editors
Organization: The official candy of the new Millennium
Date: Sun, 5 Jan 2025 05:20 UTC
References: 1 2
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.tcl,comp.unix.shell,comp.editors
Subject: Re: The "leading zero means octal" thing...
Date: Sun, 5 Jan 2025 05:20:47 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <vld4rf$2jao9$2@news.xmission.com>
References: <vlcbrr$2ito3$1@news.xmission.com> <vlce6p$lk3q$1@dont-email.me>
Injection-Date: Sun, 5 Jan 2025 05:20:47 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="2730761"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
View all headers

In article <vlce6p$lk3q$1@dont-email.me>,
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
....
>As a consequence, in Kornshell, I'm using a number prefix 10# to
>counter that misbehavior. (I'd suppose this works also in other
>major shells like Bash.)

Yes, bash has that, too. But for whatever it is worth, in at least one of
my scripts, using it was inconvenient (*), so I ended up having to use "bc" to
do a calculation instead of (the more efficient/built-in) $((...)) (**).
Sort of annoying.

(*) Didn't work out, for some reason.

(**) Which had been working fine right up until it hit the dreaded "08".

--
Pensacola - the thinking man's drink.

Subject: Re: The "leading zero means octal" thing...
From: Kenny McCormack
Newsgroups: comp.lang.tcl, comp.unix.shell, comp.editors
Organization: The official candy of the new Millennium
Date: Sun, 5 Jan 2025 05:21 UTC
References: 1 2
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.tcl,comp.unix.shell,comp.editors
Subject: Re: The "leading zero means octal" thing...
Date: Sun, 5 Jan 2025 05:21:59 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <vld4tn$2jao9$3@news.xmission.com>
References: <vlcbrr$2ito3$1@news.xmission.com> <vlcik4$md8n$1@dont-email.me>
Injection-Date: Sun, 5 Jan 2025 05:21:59 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="2730761"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
View all headers

In article <vlcik4$md8n$1@dont-email.me>, Rich <rich@example.invalid> wrote:
>In comp.lang.tcl Kenny McCormack <gazelle@shell.xmission.com> wrote:
>> I am referring, of course, to the convention that a number with a
>> leading zero is interpreted as octal. ... most recently in Tcl
>> (Expect) ...
>
>For Tcl 9, leading zero decimal number strings are no longer
>interpreted as octal:
>
>https://www.tcl-lang.com/software/tcltk/9.0.html
>
> Numbers
>
> 0NNN format is no longer octal interpretation. Use 0oNNN
>

This is good news!

I guess I'm going to have to re-compile (A private version of) Tcl and
Expect (one of these days...)

--
"He is exactly as they taught in KGB school: an egoist, a liar, but talented - he
knows the mind of the wrestling-loving, under-educated, authoritarian-admiring
white male populous."
- Malcolm Nance, p59. -

Subject: Re: The "leading zero means octal" thing...
From: Kenny McCormack
Newsgroups: comp.lang.tcl, comp.unix.shell, comp.editors
Organization: The official candy of the new Millennium
Date: Sun, 5 Jan 2025 06:33 UTC
References: 1 2 3
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.tcl,comp.unix.shell,comp.editors
Subject: Re: The "leading zero means octal" thing...
Date: Sun, 5 Jan 2025 06:33:07 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <vld933$2jcih$1@news.xmission.com>
References: <vlcbrr$2ito3$1@news.xmission.com> <eli$2501042055@qaz.wtf> <vld4k2$2jao9$1@news.xmission.com>
Injection-Date: Sun, 5 Jan 2025 06:33:07 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="2732625"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
View all headers

In article <vld4k2$2jao9$1@news.xmission.com>,
Kenny McCormack <gazelle@shell.xmission.com> wrote:
>In article <eli$2501042055@qaz.wtf>,
>Eli the Bearded <*@eli.users.panix.com> wrote:
>...
>>Vim is highly configurable. See ":help nrformats" for supported formats.
>>Not clearly documented in the version I have, but implied, is setting
>>it to a blank string to only recognize ordinary decimal numbers.
>>
>> :set nrformats=
>
>Thanks for the tip. I'll look into that.

Yes, nf looks good. I set it to "alpha", which makes it do the right thing
with letters, while ignoring the stupid hex/octal/bin stuff.

--
The randomly chosen signature file that would have appeared here is more than 4
lines long. As such, it violates one or more Usenet RFCs. In order to remain
in compliance with said RFCs, the actual sig can be found at the following URL:
http://user.xmission.com/~gazelle/Sigs/Noam

Subject: 'nf' in VIM (Was: The "leading zero means octal" thing...)
From: Kenny McCormack
Newsgroups: comp.lang.tcl, comp.unix.shell, comp.editors
Organization: The official candy of the new Millennium
Date: Sun, 5 Jan 2025 07:05 UTC
References: 1 2 3 4
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.tcl,comp.unix.shell,comp.editors
Subject: 'nf' in VIM (Was: The "leading zero means octal" thing...)
Date: Sun, 5 Jan 2025 07:05:29 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <vldavp$2jdk0$1@news.xmission.com>
References: <vlcbrr$2ito3$1@news.xmission.com> <eli$2501042055@qaz.wtf> <vld4k2$2jao9$1@news.xmission.com> <vld933$2jcih$1@news.xmission.com>
Injection-Date: Sun, 5 Jan 2025 07:05:29 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="2733696"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
View all headers

In article <vld933$2jcih$1@news.xmission.com>,
Kenny McCormack <gazelle@shell.xmission.com> wrote:
>In article <vld4k2$2jao9$1@news.xmission.com>,
>Kenny McCormack <gazelle@shell.xmission.com> wrote:
>>In article <eli$2501042055@qaz.wtf>,
>>Eli the Bearded <*@eli.users.panix.com> wrote:
>>...
>>>Vim is highly configurable. See ":help nrformats" for supported formats.
>>>Not clearly documented in the version I have, but implied, is setting
>>>it to a blank string to only recognize ordinary decimal numbers.
>>>
>>> :set nrformats=
>>
>>Thanks for the tip. I'll look into that.
>
>Yes, nf looks good. I set it to "alpha", which makes it do the right thing
>with letters, while ignoring the stupid hex/octal/bin stuff.

And one more thing...

It seems nf is buffer-local, so setting it while in one buffer does not
change it globally. Setting it in .vimrc does set it globally (which makes
sense, since no other buffers exist at that point - and they all inherit
the value).

I get why this is the way it works, but am curious if there is a way to set
it globally (without exiting and re-starting VIM, of course). I have lots
of windows and buffers open and don't want to re-start.

I read "help :set" and it covers a lot, but didn't see anything
specifically on this topic.

--
I've learned that people will forget what you said, people will forget
what you did, but people will never forget how you made them feel.

- Maya Angelou -

Subject: Re: The "leading zero means octal" thing...
From: Janis Papanagnou
Newsgroups: comp.lang.tcl, comp.unix.shell, comp.editors
Followup: comp.editors
Organization: A noiseless patient Spider
Date: Sun, 5 Jan 2025 07:39 UTC
References: 1 2 3 4
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.tcl,comp.unix.shell,comp.editors
Subject: Re: The "leading zero means octal" thing...
Followup-To: comp.editors
Date: Sun, 5 Jan 2025 08:39:54 +0100
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <vldd0c$u77e$1@dont-email.me>
References: <vlcbrr$2ito3$1@news.xmission.com> <eli$2501042055@qaz.wtf>
<vld4k2$2jao9$1@news.xmission.com> <vld933$2jcih$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 05 Jan 2025 08:40:00 +0100 (CET)
Injection-Info: dont-email.me; posting-host="6ee5967cfd6763239853a04e47fb77c4";
logging-data="990446"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18JtON/Y+PrEnS4U+yJxGwt"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:ml4cWOo1XkF8G1bUfUihWxJFqs4=
In-Reply-To: <vld933$2jcih$1@news.xmission.com>
X-Enigmail-Draft-Status: N1110
View all headers

[ f'up to comp.editors set ]

On 05.01.2025 07:33, Kenny McCormack wrote:
> In article <vld4k2$2jao9$1@news.xmission.com>,
> Kenny McCormack <gazelle@shell.xmission.com> wrote:
>> In article <eli$2501042055@qaz.wtf>,
>> Eli the Bearded <*@eli.users.panix.com> wrote:
>> ...
>>> Vim is highly configurable. See ":help nrformats" for supported formats.
>>> Not clearly documented in the version I have, but implied, is setting
>>> it to a blank string to only recognize ordinary decimal numbers.
>>>
>>> :set nrformats=
>>
>> Thanks for the tip. I'll look into that.
>
> Yes, nf looks good. I set it to "alpha", which makes it do the right thing
> with letters, while ignoring the stupid hex/octal/bin stuff.

This 'alpha' is an interesting useful feature I didn't know. Thanks.
(It will go into my .vimrc file.)

Testing it I was a bit astonished, though, that (and different from
numbers) it just works on single letters without a "carry"; with the
string "say38", operating a 66^A on the number part creates "say104"
while at any character it stops increment at "z".

(I recall that I once had a requirement to enumerate some date as
aa, ab, ac, ..., az, ba, bb, ..., bz, ..., zz, and even continuing
zz with aaa, as with a numeric carry.)

Janis

Subject: Re: The "leading zero means octal" thing...
From: Joe Makowiec
Newsgroups: comp.lang.tcl, comp.unix.shell, comp.editors
Organization: .
Date: Sun, 5 Jan 2025 15:51 UTC
References: 1
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: makowiec@invalid.invalid (Joe Makowiec)
Newsgroups: comp.lang.tcl,comp.unix.shell,comp.editors
Subject: Re: The "leading zero means octal" thing...
Date: Sun, 5 Jan 2025 15:51:55 -0000 (UTC)
Organization: .
Lines: 19
Message-ID: <XnsB25E6E86F20F0makowiecatnycapdotrE@95.217.65.137>
References: <vlcbrr$2ito3$1@news.xmission.com>
Injection-Date: Sun, 05 Jan 2025 16:51:55 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0c33c565964d9cf793871b6db19226ae";
logging-data="1151233"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18atTkCaduYbbdggNkbN722KtgdXP2SnGo="
User-Agent: Xnews/2009.05.01
Cancel-Lock: sha1:zFmFPNfPszwnryh1XJQ0cCTpwwU=
View all headers

On 04 Jan 2025 in comp.editors, Kenny McCormack wrote:

> I hit this in VIM - where if the cursor is sitting on the zero in a
> string like Foo07 and you hit ^A, it changes it to - are you ready?
> - not Foo08, but Foo010.

For what it's worth, I tried this in my edition of vim (v 9.1 on
Fedora 41, pretty much default). It incremented Foo07 to Foo08. I dug
into /usr/share/vim/vim91/defaults.vim and found this:

" Do not recognize octal numbers for Ctrl-A and Ctrl-X, most users find it
" confusing.
set nrformats-=octal

--
Joe Makowiec
http://makowiec.org/
Email: http://makowiec.org/contact/?Joe
Usenet Improvement Project: http://twovoyagers.com/improve-usenet.org/

Subject: Re: The "leading zero means octal" thing...
From: saito
Newsgroups: comp.lang.tcl, comp.unix.shell, comp.editors
Organization: A noiseless patient Spider
Date: Sun, 5 Jan 2025 21:35 UTC
References: 1
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: saitology9@gmail.com (saito)
Newsgroups: comp.lang.tcl,comp.unix.shell,comp.editors
Subject: Re: The "leading zero means octal" thing...
Date: Sun, 5 Jan 2025 16:35:27 -0500
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <vletuv$17djb$1@dont-email.me>
References: <vlcbrr$2ito3$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 05 Jan 2025 22:35:28 +0100 (CET)
Injection-Info: dont-email.me; posting-host="207371964f0fc4c3cb3790018771a172";
logging-data="1291883"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+QHPoSeveprNXaAbkE1cqO"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:7S1BX6V8pnR5QdQc3lvt4/Hqp0o=
In-Reply-To: <vlcbrr$2ito3$1@news.xmission.com>
Content-Language: en-US
View all headers

On 1/4/2025 5:14 PM, Kenny McCormack wrote:
> First of all, yes, I know this is all standardized and it is based on
> legacy C conventions and it can't be changed and so on and so forth.
>
> But if not a bug, it is certainly a misfeature.
>
> I am referring, of course, to the convention that a number with a leading
> zero is interpreted as octal. I can't count the number of times I've been
> bitten by this - in various languages/environments all across the Unix
> ecosystem. Note the choice of newsgroups above - I have been affected by
> this in each of these environments - most recently in Tcl (Expect) and in
> the VIM editor.
>

I can't help but think that this may be related to your post regarding
time calculation. I had left this quote in my reply:

> There is an interesting "octal" problem left as an exercise 🙂

This was exactly the exercise as well. "clock format" leaves leading
zeros in the result depending on what time it was. It is missing "string
trimleft" calls which I'd discovered after some test runs before posting.

Subject: Re: The "leading zero means octal" thing...
From: Kenny McCormack
Newsgroups: comp.lang.tcl, comp.unix.shell, comp.editors
Organization: The official candy of the new Millennium
Date: Sun, 5 Jan 2025 21:55 UTC
References: 1 2
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.tcl,comp.unix.shell,comp.editors
Subject: Re: The "leading zero means octal" thing...
Date: Sun, 5 Jan 2025 21:55:10 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <vlev3u$2k7dc$1@news.xmission.com>
References: <vlcbrr$2ito3$1@news.xmission.com> <vletuv$17djb$1@dont-email.me>
Injection-Date: Sun, 5 Jan 2025 21:55:10 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="2760108"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
View all headers

In article <vletuv$17djb$1@dont-email.me>, saito <saitology9@gmail.com> wrote:
....
>I can't help but think that this may be related to your post regarding
>time calculation. I had left this quote in my reply:
>
>> There is an interesting "octal" problem left as an exercise
>
>This was exactly the exercise as well. "clock format" leaves leading
>zeros in the result depending on what time it was. It is missing "string
>trimleft" calls which I'd discovered after some test runs before posting.

It is, in fact, related to that other thread. In fact, I had developed an
entirely different solution to that problem (very short, in fact) which had
been running fine for a few weeks until it happened to hit the dreaded "08"
and crashed. I fixed that basically by adding code using "regsub" to
remove any leading zero before doing the calculations.

I'll have to take a look at "string trimleft".

--
Which of these is the crazier bit of right wing lunacy?
1) We've just had another mass shooting; now is not the time to be talking about gun control.

2) We've just had a massive hurricane; now is not the time to be talking about climate change.

Subject: Re: The "leading zero means octal" thing...
From: Eric Pozharski
Newsgroups: comp.lang.tcl, comp.unix.shell, comp.editors
Followup: comp.unix.shell
Organization: A noiseless patient Spider
Date: Mon, 6 Jan 2025 08:24 UTC
References: 1
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: apple.universe@posteo.net (Eric Pozharski)
Newsgroups: comp.lang.tcl,comp.unix.shell,comp.editors
Subject: Re: The "leading zero means octal" thing...
Followup-To: comp.unix.shell
Date: Mon, 06 Jan 2025 08:24:54 +0000
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <slrnvnn4qm.ro4.apple.universe@freight.zombinet>
References: <vlcbrr$2ito3$1@news.xmission.com>
Injection-Date: Mon, 06 Jan 2025 11:33:15 +0100 (CET)
Injection-Info: dont-email.me; posting-host="5503e537a34553856204283a68ec2277";
logging-data="1664938"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19oA8IuO+vKFmZtwZAVCJvz"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:oMExDb0ya1y+C2FWO9TqUDRG4xY=
View all headers

["Followup-To:" header set to comp.unix.shell.] # because tcl and vim are covered.

with <vlcbrr$2ito3$1@news.xmission.com> Kenny McCormack wrote:
> First of all, yes, I know this is all standardized and it is based on
> legacy C conventions and it can't be changed and so on and so forth.
*CUT* [ 16 lines 1 level deep]
> Totally weird and unexpected.

Quick grep through bash.info yelded nothing. But there is hope -- come
to the dark side, zsh has cookies:

% echo $(( 010 - 1 ))
9

--
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom

1

rocksolid light 0.9.8
clearnet tor