Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Oct 2017 00:50:37 +0200
From:      Anton Berezin <tobez@tobez.org>
To:        crew@infogalactic.com
Cc:        freebsd-perl@freebsd.org
Subject:   Re: Weird issue with PERL hashes on FreeBSD with EasyTimeline.pl that does not occur on RHEL 7.2
Message-ID:  <C1C571B0-4029-4FAA-8766-225DB3D0E82A@tobez.org>
In-Reply-To: <789ab286c78d90e4077033fb589f3d29@infogalactic.com>
References:  <789ab286c78d90e4077033fb589f3d29@infogalactic.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello,

> On 2 Oct 2017, at 21:08, Crew <carborundumcrew@infogalactic.com> =
wrote:
>=20
> An issue has turned up, seemingly with PERL hashes on FreeBSD =
10.3-STABLE and 10.3-RELEASE-p21.
>=20
> It involves a PERL script called EasyTimeline.pl. I have a simple =
reproducer that involves running EasyTimeline.pl with some ,input data =
(but you also need ploticus installed.)
>=20
> When run on those two versions of FreeBSD the script will fail =
something like one out of five to seven times, but on RHEL 7.2 it never =
fails. On FreeBSD it will often fail the first time it is run, and then =
will succeed for the next five or so attempts and then fail again.
>=20
> It seems to relate to one key in a hash being a proper prefix of =
another and the order in which the keys are in the hash. In this case =
the keys are "grid" and "gridcolor=E2=80=9D.

In Perl, one cannot rely on any particular order while iterating a hash, =
so if something further down the line expects things to be in certain =
order, the script has to be modified to supply the correct order.
This has really nothing to do with FreeBSD.  Most likely it has =
something to do with the version of perl on those two platforms (which =
you have not specified), since, if I remember correctly, the order of =
hash keys during iteration (or the invocation of the =E2=80=9Ckeys=E2=80=9D=
 operator) has been deliberately randomized in the more recent versions =
of perl interpreter.

Finally, there is =E2=80=9Cperl=E2=80=9D the interpreter, and =E2=80=9CPer=
l=E2=80=9D the language.  There is no =E2=80=9CPERL=E2=80=9D.  This is =
important to some people.

Hope this helps,
\Anton.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C1C571B0-4029-4FAA-8766-225DB3D0E82A>