Skip to content

Non deterministic result for $..* on scalar value #12

Description

@tobyink

Migrated from rt.cpan.org #131456 (status was 'open')

Requestors:

From christoph.burgmer@gmail.com on 2020-01-14 07:32:04
:

It seems a recent bump in Alpine 3.11 from 3.10 has changed the Perl
version from
This is perl 5, version 28, subversion 2 (v5.28.2)
to
This is perl 5, version 30, subversion 1 (v5.30.1)
and also changed the response from JSON::Path for the edge case of $..* run
on a document of the number 42 from an error response to the result of an
empty array.

However on OS X with the same newer Perl version the previous error
response can still be seen:

$ echo 42 | perl main.pl '$..*'
Unable to decode 42 as JSON: malformed JSON string, neither tag, array,
object, number, string or atom, at character offset 0 (before "(end of
string)") at build/lib/perl5/JSON/Path/Evaluator.pm line 81, line 1.
at build/lib/perl5/JSON/Path/Evaluator.pm line 79.
$ perl --version

This is perl 5, version 30, subversion 1 (v5.30.1) built for
darwin-thread-multi-2level
[...]
$ uname -s
Darwin

vs.

$ docker run --rm -it -v "$(pwd):/mydir" alpine:3.11 sh
/ # apk add perl
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch
http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/2) Installing libbz2 (1.0.8-r1)
(2/2) Installing perl (5.30.1-r0)
Executing busybox-1.31.1-r8.trigger
OK: 42 MiB in 16 packages
/ # cd mydir/
/mydir # echo 42 | perl main.pl '$..*'
[]
/mydir # perl --version

This is perl 5, version 30, subversion 1 (v5.30.1) built for
x86_64-linux-thread-multi
[...]

This currently makes it hard to reproduce the same results for the
json-path-comparison across the Docker and native build (at least on OS X).
I would be grateful for any pointers into why the behaviour would be
different.

Script is here:
https://github.com/cburgmer/json-path-comparison/blob/master/implementations/Perl_JSON-Path/main.pl

For completeness, I'm tracking this issue on the other side under
cburgmer/json-path-comparison#24.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions