From owner-freebsd-perl@FreeBSD.ORG Sat Jan 3 13:57:19 2009 Return-Path: Delivered-To: freebsd-perl@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 420D51065672 for ; Sat, 3 Jan 2009 13:57:19 +0000 (UTC) (envelope-from tobez@tobez.org) Received: from heechee.tobez.org (heechee.tobez.org [194.255.56.42]) by mx1.freebsd.org (Postfix) with ESMTP id 0A1F28FC13 for ; Sat, 3 Jan 2009 13:57:18 +0000 (UTC) (envelope-from tobez@tobez.org) Received: by heechee.tobez.org (Postfix, from userid 1001) id 3F5FA6D401; Sat, 3 Jan 2009 14:57:18 +0100 (CET) Date: Sat, 3 Jan 2009 14:57:18 +0100 From: Anton Berezin To: Fernan Aguero Message-ID: <20090103135718.GC41513@heechee.tobez.org> References: <520894aa0901020758o79bb1233teee539f6d599d10a@mail.gmail.com> <20090102164439.GF40649@heechee.tobez.org> <520894aa0901030433i7a103ba7i4236ae17b83c6eae@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <520894aa0901030433i7a103ba7i4236ae17b83c6eae@mail.gmail.com> X-Powered-By: FreeBSD http://www.freebsd.org/ User-Agent: Mutt/1.5.18 (2008-05-17) Cc: freebsd-perl@freebsd.org Subject: Re: Storable byteorder incompatibilities in different FreeBSD installations X-BeenThere: freebsd-perl@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: maintainer of a number of perl-related ports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jan 2009 13:57:19 -0000 Fernan, On Sat, Jan 03, 2009 at 10:33:22AM -0200, Fernan Aguero wrote: > Apart from the byteorder issue, the other issue which I raised in my > post, was also the incompatibility in 'longsize' between two perl > instances built from ports, in different boxes. > > In this case, the perl built in a FBSD-6.3, i386 box has a longsize of > 4, whereas the same perl built in FBSD-7.1, amd64 has a longsize of 8. > In both cases they were compiled with PERL_64BITINT (the default for > the port), and in both cases the byteorder is the same! > > How can I build a perl with a byteorder of 12345678, and a longsize of > 4, in an amd64 platform? Is that possible at all? Not really. Amd64 is a 64-bit platform, meaning sizeof(long) = 8. I am pretty positive that the same is true for x86-64 Linux. That's more or less what "12345678" indicates. At any rate, this is the application design issue. The practical solution in your case would be to take an offline copy of the DB, and to go through every record and convert it into a KNOWN to you binary format. I have not done the relevant testing, so I do not even know whether nstore() will do what you want - after all, it only handles the byteorder issues, not integer size issues. It is dangerous to make assumptions about bytesizes of various structures on different architectures - you've got to do some sort of conversion yourself, "native to known" during the store operation, and "known to native" during the retrieve operation. This is just a common sense design principle. Cheers, \Anton. -- There is no beauty in entropy. -- Eliezer Yudkowsky