Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: intepreting octal and globbing breakage



> That's one of the reasons I just made a test release rather than the
> real thing.  I'll probably have to go back using zstrtol.  That would
> also make it easy to fix it so that numbers beginning with '0' are not
> interpreted as octal.  I sorta hate to do this, since then zstrtol
> would be even more incompatible with the standard strtol.  I also hate

Why? It can be compatible with the standard, but we should call it with base
10 from zzlex.

> the idea of interpreting 0xff has hex, but not interpreting 010 as
> octal.  I also hate the idea of adding (yet another) option to control
> this.
> 
> What does ksh and bash do?  I'm inclined to go with the principle of
> least surprise and make this compatible with however the other shells
> handle this.

Bash version 1.14.3 always treat 010 az octal and 0xff as hex in math, and it
segfaults on echo $[09] (at least with Solaris 2.3) :-). ksh ignores leading
zeros. I see that interpreting 0xff as hex but 010 as decimal is not too
elegant, but it does not hurt anyone. The alternative is to give unballanced
stack error on 0xff and if I have to choose I'd choose 0xff to be a hex
number. It can be done in zzlex.

Zoltan



Messages sorted by: Reverse Date, Date, Thread, Author