Weird issue with PERL hashes on FreeBSD with EasyTimeline.pl that does not occur on RHEL 7.2
Crew
carborundumcrew at infogalactic.com
Tue Oct 3 00:30:02 UTC 2017
On 2017-10-02 15:50, Anton Berezin wrote:
> Hello,
>
>> On 2 Oct 2017, at 21:08, Crew <carborundumcrew at infogalactic.com>
>> wrote:
>>
>> An issue has turned up, seemingly with PERL hashes on FreeBSD
>> 10.3-STABLE and 10.3-RELEASE-p21.
>>
>> 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.)
>>
>> 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.
>>
>> 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”.
>
> 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.
As far as I can tell, the code, which I did not write, does not depend
on the order of keys in the hash. The problem seems to be that in some
instances the value returned when probing the hash with the shorter key
is undefined on some runs even though both keys are in the hash.
> 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 “keys” operator)
> has been deliberately randomized in the more recent versions of perl
> interpreter.
RHEL 7.2:
This is perl 5, version 16, subversion 3 (v5.16.3) built for
x86_64-linux-thread-multi
(with 34 registered patches, see perl -V for more detail)
FreeBSD 10.3-Release-p21:
Summary of my perl5 (revision 5 version 20 subversion 3) configuration:
Platform:
osname=freebsd, osvers=10.1-release-p37,
archname=amd64-freebsd-thread-multi
uname='freebsd 101amd64-quarterly-job-01 10.1-release-p37 freebsd
10.1-release-p37 amd64 '
--
Infogalactic: the planetary knowledge core
More information about the freebsd-perl
mailing list