From owner-freebsd-standards@FreeBSD.ORG Tue Apr 8 01:51:15 2003 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E0F0B37B401 for ; Tue, 8 Apr 2003 01:51:15 -0700 (PDT) Received: from snark.ratmir.ru (snark.ratmir.ru [213.24.248.177]) by mx1.FreeBSD.org (Postfix) with ESMTP id CAE9943F75 for ; Tue, 8 Apr 2003 01:51:14 -0700 (PDT) (envelope-from freebsd@snark.ratmir.ru) Received: from snark.ratmir.ru (freebsd@localhost [127.0.0.1]) by snark.ratmir.ru (8.12.9/8.12.9) with ESMTP id h388pDDR024195 for ; Tue, 8 Apr 2003 12:51:13 +0400 (MSD) (envelope-from freebsd@snark.ratmir.ru) Received: (from freebsd@localhost) by snark.ratmir.ru (8.12.9/8.12.9/Submit) id h388pDNR024194 for freebsd-standards@freebsd.org; Tue, 8 Apr 2003 12:51:13 +0400 (MSD) Date: Tue, 8 Apr 2003 12:51:12 +0400 From: Alex Semenyaka To: freebsd-standards@freebsd.org Message-ID: <20030408085112.GA22222@snark.ratmir.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.4i Subject: /bin/sh arithmetics: BIG NUMBERS X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Apr 2003 08:51:16 -0000 Collegues, I need your opinion. Several days ago I've send to -hackers mailing list a patch for /bin/sh which introduce 64-bit arithmetic operations instead of 32-bit ones we have now. There were now principal objections there but Giorgos Keramidas adviced me to ask here about the FreeBSD's standards compliance of this. I hope that it IS ok withem but I want to be absolutely sure. Argumentation "pro": 1) POSIX and SUSv3 _require_ at least long type for integers in the shell, and explicitly _allow_ to use integer in the range beyond the long type range. SUSv2 _requires_ long and _allows_ extensions as well (but there are no explicit words about wider range as in SUSv3). It is the theoretical aspect. 2) ksh, zsh and bash handle longer integers properly. The last two have 64-bit arithmetics and first one has float inside. That is the compatibility aspect. 3) These days we have a lot of 64-bit stuff in the system: from ipfw counters to file sizes. Moreover we really have such big numbers in everyday FreeBSD usage. But now /bin/sh silently produce just wrong results dealing with such numbers due to overflow. So old scripts which worked from 1997 or such now can produce meaningless results and it will not be even noticed. I can suggest to write new ones with bash or zsh but some people continue to use their old stuff (don't touch while works, you know). So it IS better to change our basic shell and extend it's abilities. That is the practical aspect. Any "contras"? SY, Alex