From owner-freebsd-perl@FreeBSD.ORG Sat Jan 3 12:33:23 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 50F80106564A for ; Sat, 3 Jan 2009 12:33:23 +0000 (UTC) (envelope-from fernan.aguero@gmail.com) Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.25]) by mx1.freebsd.org (Postfix) with ESMTP id 005BE8FC14 for ; Sat, 3 Jan 2009 12:33:22 +0000 (UTC) (envelope-from fernan.aguero@gmail.com) Received: by qw-out-2122.google.com with SMTP id 9so3980653qwb.7 for ; Sat, 03 Jan 2009 04:33:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=BrkfLdrS6GlCT90bY5LwklSzty/fBqTHEMrWSuWmlNs=; b=STqvaEorS0BrpwzK7ZdlrsPEMXRdG3pKl8DCBTlBm5PGquVckl0o/aYOIVIQ8DVP4+ Z1GVc1nTeCZo2muHBEKPN2HS7YauM8GVYijWmQ/1jySJZ0jfNRW9AtUBEdN9pA6W5AE6 c2VnKULrbMmuAStwpamaHEfxnNG0AkfPrMkMU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=OsKMGLQc0GuuIgvQLGIe8KZmTlwmi2tSfdAu4EXiRowPEwMEn84/imO9srgi+6p8zY v3uaZ7wPbHLU4fPgN5A8uM67WjD06k6FjwDFLSGVbxlPbNsXRP1mfIgafDbP58FZmzUC K/h80ofRIOVBZMoWi+SxatzzjUMdA5n6NoHN4= Received: by 10.215.39.5 with SMTP id r5mr15576959qaj.149.1230986002119; Sat, 03 Jan 2009 04:33:22 -0800 (PST) Received: by 10.214.45.3 with HTTP; Sat, 3 Jan 2009 04:33:22 -0800 (PST) Message-ID: <520894aa0901030433i7a103ba7i4236ae17b83c6eae@mail.gmail.com> Date: Sat, 3 Jan 2009 10:33:22 -0200 From: "Fernan Aguero" To: "Anton Berezin" In-Reply-To: <20090102164439.GF40649@heechee.tobez.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <520894aa0901020758o79bb1233teee539f6d599d10a@mail.gmail.com> <20090102164439.GF40649@heechee.tobez.org> 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 12:33:23 -0000 Hi Anton, On Fri, Jan 2, 2009 at 2:44 PM, Anton Berezin wrote: > On Fri, Jan 02, 2009 at 01:58:06PM -0200, Fernan Aguero wrote: > >> I've been bitten by binary incompatibilitiess (bytorder, and/or byte >> sizes of ints, longs, and whatnot) between two perl installations >> (both on FreeBSD, using latest perl5.8 from ports). > > [...] > >> Binary incompatibilities when reading the Storable binary data have >> been observed in the past when running the web application from Linux >> boxes (Ubuntu, i386 or amd64). > >> So why is it that building Perl outside of the ports system makes the >> test program report '1234' which is what I would expect from an i386 >> box, while it gives '12345678' when running from within the ports >> system? Why this unusual byteorder? > > This is because of PERL_64BITINT (aka -Duse64bitint) is the > default with the port. That is only useful in i386. In amd64, it doesn't change anything. With or Without that define, the outcome is always: perl -MConfig -le "print @Config{byteorder}" 12345678 perl -MConfig -le "print @Config{shortsize}" 2 perl -MConfig -le "print @Config{intsize}" 4 perl -MConfig -le "print @Config{longsize}" 8 perl -MConfig -le "print @Config{longlongsize}" 8 [tested in FreeBSD-7.1 RC1, amd64] In FreeBSD-6.3, i386, unchecking PERL_64BITINT would give: perl -MConfig -le "print @Config{byteorder}" 1234 perl -MConfig -le "print @Config{longsize}" 4 [all others being equal] In FreeBSD-6.3, i386 with PERL_64BITINT: perl -MConfig -le "print @Config{byteorder}" 12345678 perl -MConfig -le "print @Config{longsize}" 4 [all others being equal] 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? Looking at the output of perl -V in these different Perls, in the Compiler section I see (from the diff attached in my previous message, this is from a build in i386) - intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 + intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 Can we toggle these compiler options? >> And now for a pragmatic and urgent question: >> iv) how can I use the ports system to build a Perl in different FBSD >> boxes that would result in the same binary configuration (byteorder, >> shortsize, intsize, etc.) to guarantee it would produce compatible >> (i.e. readable from other FBSD boxes) dumps of Perl data structures? > > Uncheck PERL_64BITINT in the configuration dialog. (make rmconfig > first) > > Apart from that, do you actually use "nstore" variants of Storable > functions? If you use it consistently in you application, you > might find out that the problem disappears, and it would not > matter what platform you use. I know about nstore, and I am switching my code to use nstore for future releases. But, as it stands now, I've already made the mistake of using plain 'store' in all my production code, which means I have lots of data already written in the DB that I need to be able to read with binary-compatible perl/Storable instances. I can do that currently using the perl instance I have in FBSD-6, i386. But I was wondering if it's possible to make the port build a perl with a different 'binary' configuration. You might want to think about this problem in the following terms: i) you have lots of data dumped from perl in a specific binary format ii) your old hardware is gone/lost iii) you need to build a perl in a new box, perhaps in a different platform, that would read these Storable dumps. Is this possible using the FreeBSD perl port? In my case, this would be translated to: can I build a perl instance with a byteorder of 12345678, and a longsize of 4 in a FreeBSD-7.1, amd64 box? Cheers, Fernan > Cheers, > \Anton. -- fernan