From owner-freebsd-fs@FreeBSD.ORG Tue Jun 15 08:42:21 2010 Return-Path: Delivered-To: fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEE3B106566B for ; Tue, 15 Jun 2010 08:42:21 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from smtp107.plus.mail.re1.yahoo.com (smtp107.plus.mail.re1.yahoo.com [69.147.102.70]) by mx1.freebsd.org (Postfix) with SMTP id 800B58FC12 for ; Tue, 15 Jun 2010 08:42:21 +0000 (UTC) Received: (qmail 16398 invoked from network); 15 Jun 2010 08:15:40 -0000 Received: from [10.141.19.34] (se@88.128.88.17 with plain) by smtp107.plus.mail.re1.yahoo.com with SMTP; 15 Jun 2010 01:15:32 -0700 PDT X-Yahoo-SMTP: iDf2N9.swBDAhYEh7VHfpgq0lnq. X-YMail-OSG: h8nvFesVM1k1GSt3kSinb83T3dgRmAUe7aelWCO1FlGIvvX 1KQtP_ZW6e.V7wTaV3I_WB8aW2aLoWVy47cddsFDEB2uHodY7YBnsbKhcbDs GrFMEVNyDiXg.WrpZ1SY398vAwb.aEq.1hkouPs._8VqfIt8WddbuX8AhDNU Fqye6gZOHZyobHohAk34YR5tfm11uKPRtN6Sza.UrEFC_p.aFk0Bj_9p1RIs ZXZBVtiKJyCXUTXDY7.TaQDYqt8V28m1uZlIXWiPHSkJe7ny6Mx4KqKYk8BM sBP5HBeTM0Gx_xnNEaEKOj5XvR9jSi7zCiZEZAzzYhdk3b5WJ7QgGjyFsR8N d3v9OYXoqXCt9VMBU7iWivCLNpjuH7TdVKFM2sQrAc9wSSrzH3LlEThlg40S P8OM- X-Yahoo-Newman-Property: ymail-5 Message-ID: <4C173693.9020603@FreeBSD.org> Date: Tue, 15 Jun 2010 10:15:15 +0200 From: Stefan Esser User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.18) Gecko/20081105 Thunderbird/2.0.0.18 ThunderBrowse/3.2.2.1 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Alexander Leidinger References: <20100609162627.11355zjzwnf7nj8k@webmail.leidinger.net> <4C0FAE2A.7050103@dataix.net> <4C0FB1DE.9080508@dataix.net> <20100610115324.10161biomkjndvy8@webmail.leidinger.net> <20100610173825.164930ekkryr5tes@webmail.leidinger.net> <4C1138D0.7070901@dataix.net> <20100611104219.51344ag1ah7br4kk@webmail.leidinger.net> <4C137ACE.9080900@dataix.net> <20100615095330.89843jrd13kffdkw@webmail.leidinger.net> In-Reply-To: <20100615095330.89843jrd13kffdkw@webmail.leidinger.net> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: fs@freebsd.org Subject: Re: Do we want a periodic script for a zfs scrub? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jun 2010 08:42:22 -0000 Am 15.06.2010 09:53, schrieb Alexander Leidinger: > Quoting jhell (from Sat, 12 Jun 2010 08:17:18 -0400): > >> On 06/11/2010 04:42, Alexander Leidinger wrote: >> : #!/bin/sh >> : >> : lastscrub=$(zpool history exports |grep scrub |tail -1 |cut -f1 -d.) >> : todayjul=$(date -j -f "%Y-%m-%d" "+%j" $(date "+%Y-%m-%d")) >> : scrubjul=$(date -j -f "%Y-%m-%d" "+%j" $lastscrub) >> : >> : echo $lastscrub Last Scrub From zpool history >> : echo $todayjul Today converted to julian >> : echo $scrubjul Last scrub converted to julian >> : >> : expired=$(($todayjul-$scrubjul)) >>> >>> Apart from the fact that we can do this with one $(( ))... what happens >>> if/when time_t is extended to 64 bits on 32 bit platforms? Can we get >>> into trouble with the shell-arithmetic or not? It depends upon the >>> bit-size of the shell integers, and the signedness of them. Jilles (our >>> shell maintainer) suggested also to use the seconds since epoch and I >>> asked him the same question. I'm waiting for an answer from him. >>> >> >> I do not think this would be a problem for the script as the script is >> relying on date for the conversion except for the subtraction that is >> taking place. >> >> If there was a problem then I would believe it would have to be >> corrected in date(1) & possibly sh(1), I could be wrong though. > > The question is if the integer arithmetic in shell is supposed/allowed > to handle 64bit unsigned integers on 32bit machines or not. I extended expr and test (standalone binaries and /bin/sh builtins) to handle 64 bit on i386 a looong time ago (and I also added overflow checks to all calculations). But then it was decided, that POSIX demands 32 bit range on 32 bit machines, so support for 64 bit range was made conditional on a switch (expr -e if memory serves me right ...). So yes, 64 bit range is available on all platforms. Best regards, STefan