Hello community, here is the log from the commit of package perl-JSON-XS for openSUSE:Factory checked in at 2013-06-05 17:51:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-JSON-XS (Old) and /work/SRC/openSUSE:Factory/.perl-JSON-XS.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-JSON-XS" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-JSON-XS/perl-JSON-XS.changes 2011-11-21 12:42:06.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.perl-JSON-XS.new/perl-JSON-XS.changes 2013-06-05 17:51:18.000000000 +0200 @@ -1,0 +2,17 @@ +Wed Jun 5 08:30:08 UTC 2013 - co...@suse.com + +- updated to 2.34 + - work around bugs in perl 5.18 breaking more than 100 + widely used modules, without a fix in sight because + p5pers don't care about CPAN anymore. + - when canonicalising, only allocate up to 64 hash key + pointers on the stack. for larger hashes, use the heap, + to avoid using too much stackspace. + - discuss the problem with setlocale (reported by a few victims). + + - internal encode/decode XS wrappers did not expect stack + moves caused by callbacks (analyzed and testcase by Jesse Luehrs). + - add bencode as to/from option in bin/json_xs. + - add -e option to json_xs, and none and string in/out formats. + +------------------------------------------------------------------- Old: ---- JSON-XS-2.32.tar.gz New: ---- JSON-XS-2.34.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-JSON-XS.spec ++++++ --- /var/tmp/diff_new_pack.dWX4V5/_old 2013-06-05 17:51:19.000000000 +0200 +++ /var/tmp/diff_new_pack.dWX4V5/_new 2013-06-05 17:51:19.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-JSON-XS # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -15,54 +15,52 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -# norootforbuild - Name: perl-JSON-XS +Version: 2.34 +Release: 0 %define cpan_name JSON-XS Summary: JSON serialising/deserialising, done correctly and fast -Version: 2.32 -Release: 1 License: GPL-1.0+ or Artistic-1.0 Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/JSON-XS/ -# http://search.cpan.org/CPAN/authors/id/M/ML/MLEHMANN/JSON-XS-%{version}.tar.gz -Source: %{cpan_name}-%{version}.tar.gz +Source: http://www.cpan.org/authors/id/M/ML/MLEHMANN/%{cpan_name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build -%{perl_requires} BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(common::sense) +#BuildRequires: perl(JSON::XS) Requires: perl(common::sense) +%{perl_requires} %description This module converts Perl data structures to JSON and vice versa. Its -primary goal is to be *correct* and its secondary goal is to be *fast*. -To reach the latter goal it was written in C. +primary goal is to be _correct_ and its secondary goal is to be _fast_. To +reach the latter goal it was written in C. -Beginning with version 2.0 of the JSON module, when both JSON and -JSON::XS are installed, then JSON will fall back on JSON::XS (this can -be overridden) with no overhead due to emulation (by inheriting -constructor and methods). If JSON::XS is not available, it will fall -back to the compatible JSON::PP module as backend, so using JSON instead -of JSON::XS gives you a portable JSON API that can be fast when you need -and doesn`t require a C compiler when that is a problem. - -As this is the n-th-something JSON module on CPAN, what was the reason -to write yet another JSON module? While it seems there are many JSON -modules, none of them correctly handle all corner cases, and in most -cases their maintainers are unresponsive, gone missing, or not listening -to bug reports for other reasons. - -Author: -------- - Marc Lehmann <schm...@schmorp.de> +Beginning with version 2.0 of the JSON module, when both JSON and JSON::XS +are installed, then JSON will fall back on JSON::XS (this can be +overridden) with no overhead due to emulation (by inheriting constructor +and methods). If JSON::XS is not available, it will fall back to the +compatible JSON::PP module as backend, so using JSON instead of JSON::XS +gives you a portable JSON API that can be fast when you need and doesn't +require a C compiler when that is a problem. + +As this is the n-th-something JSON module on CPAN, what was the reason to +write yet another JSON module? While it seems there are many JSON modules, +none of them correctly handle all corner cases, and in most cases their +maintainers are unresponsive, gone missing, or not listening to bug reports +for other reasons. + +See MAPPING, below, on how JSON::XS maps perl values to JSON values and +vice versa. %prep %setup -q -n %{cpan_name}-%{version} +find . -type f -print0 | xargs -0 chmod 644 %build -%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" +%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" %{__make} %{?_smp_mflags} %check @@ -73,11 +71,8 @@ %perl_process_packlist %perl_gen_filelist -%clean -%{__rm} -rf $RPM_BUILD_ROOT - %files -f %{name}.files -%defattr(-,root,root,-) +%defattr(-,root,root,755) %doc Changes COPYING README %changelog ++++++ JSON-XS-2.32.tar.gz -> JSON-XS-2.34.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-XS-2.32/Changes new/JSON-XS-2.34/Changes --- old/JSON-XS-2.32/Changes 2011-08-11 19:06:44.000000000 +0200 +++ new/JSON-XS-2.34/Changes 2013-05-23 11:30:39.000000000 +0200 @@ -1,12 +1,29 @@ Revision history for Perl extension JSON::XS TODO: maybe detetc and croak on more invalid inputs (e.g. +-inf/nan) +TODO: maybe avoid the reblessing and better support readonly objects. +TODO: http://stevehanov.ca/blog/index.php?id=104 compression + +2.34 Thu May 23 11:30:34 CEST 2013 + - work around bugs in perl 5.18 breaking more than 100 + widely used modules, without a fix in sight because + p5pers don't care about CPAN anymore. + - when canonicalising, only allocate up to 64 hash key + pointers on the stack. for larger hashes, use the heap, + to avoid using too much stackspace. + - discuss the problem with setlocale (reported by a few victims). + +2.33 Wed Aug 1 21:03:52 CEST 2012 + - internal encode/decode XS wrappers did not expect stack + moves caused by callbacks (analyzed and testcase by Jesse Luehrs). + - add bencode as to/from option in bin/json_xs. + - add -e option to json_xs, and none and string in/out formats. 2.32 Thu Aug 11 19:06:38 CEST 2011 - fix a bug in the initial whitespace accumulation. 2.31 Wed Jul 27 17:53:05 CEST 2011 - - don't accumulate initial whitespace in the incremental buffer + - don't accumulate initial whitespace in the incremental buffer (this can be useful to allow whitespace-keepalive on a tcp connection without triggering the max_size limit). - properly croak on some invalid inputs that are not strings diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-XS-2.32/META.json new/JSON-XS-2.34/META.json --- old/JSON-XS-2.32/META.json 2011-08-11 19:06:46.000000000 +0200 +++ new/JSON-XS-2.34/META.json 2013-05-23 11:31:44.000000000 +0200 @@ -4,7 +4,7 @@ "unknown" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 6.58, CPAN::Meta::Converter version 2.110930001", + "generated_by" : "ExtUtils::MakeMaker version 6.64, CPAN::Meta::Converter version 2.120630", "license" : [ "unknown" ], @@ -22,20 +22,20 @@ "prereqs" : { "build" : { "requires" : { - "ExtUtils::MakeMaker" : 0 + "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { - "ExtUtils::MakeMaker" : 0 + "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { - "common::sense" : 0 + "common::sense" : "0" } } }, "release_status" : "stable", - "version" : "2.32" + "version" : "2.34" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-XS-2.32/META.yml new/JSON-XS-2.34/META.yml --- old/JSON-XS-2.32/META.yml 2011-08-11 19:06:46.000000000 +0200 +++ new/JSON-XS-2.34/META.yml 2013-05-23 11:31:44.000000000 +0200 @@ -7,7 +7,7 @@ configure_requires: ExtUtils::MakeMaker: 0 dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 6.58, CPAN::Meta::Converter version 2.110930001' +generated_by: 'ExtUtils::MakeMaker version 6.64, CPAN::Meta::Converter version 2.120630' license: unknown meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -19,4 +19,4 @@ - inc requires: common::sense: 0 -version: 2.32 +version: 2.34 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-XS-2.32/README new/JSON-XS-2.34/README --- old/JSON-XS-2.32/README 2011-08-11 19:06:46.000000000 +0200 +++ new/JSON-XS-2.34/README 2013-05-23 11:31:44.000000000 +0200 @@ -371,7 +371,8 @@ If $enable is false, then the "encode" method will output key-value pairs in the order Perl stores them (which will likely change - between runs of the same script). + between runs of the same script, and can change even within the same + run from 5.18 onwards). This option is useful if you want the same data structure to be encoded as the same JSON text (given the same overall settings). If @@ -1322,6 +1323,22 @@ (It might actually work, but you have been warned). +THE PERILS OF SETLOCALE + Sometimes people avoid the Perl locale support and directly call the + system's setlocale function with "LC_ALL". + + This breaks both perl and modules such as JSON::XS, as stringification + of numbers no longer works correcly (e.g. "$x = 0.1; print "$x"+1" might + print 1, and JSON::XS might output illegal JSON as JSON::XS relies on + perl to stringify numbers). + + The solution is simple: don't call "setlocale", or use it for only those + categories you need, such as "LC_MESSAGES" or "LC_CTYPE". + + If you need "LC_NUMERIC", you should enable it only around the code that + actually needs it (avoiding stringification of numbers), and restore it + afterwards. + BUGS While the goal of this module is to be correct, that unfortunately does not mean it's bug-free, only that I think its design is bug-free. If you diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-XS-2.32/XS.pm new/JSON-XS-2.34/XS.pm --- old/JSON-XS-2.32/XS.pm 2011-08-11 12:31:04.000000000 +0200 +++ new/JSON-XS-2.34/XS.pm 2013-05-23 11:31:22.000000000 +0200 @@ -103,7 +103,7 @@ use common::sense; -our $VERSION = '2.32'; +our $VERSION = 2.34; our @ISA = qw(Exporter); our @EXPORT = qw(encode_json decode_json to_json from_json); @@ -434,7 +434,8 @@ If C<$enable> is false, then the C<encode> method will output key-value pairs in the order Perl stores them (which will likely change between runs -of the same script). +of the same script, and can change even within the same run from 5.18 +onwards). This option is useful if you want the same data structure to be encoded as the same JSON text (given the same overall settings). If it is disabled, @@ -1447,6 +1448,24 @@ (It might actually work, but you have been warned). +=head1 THE PERILS OF SETLOCALE + +Sometimes people avoid the Perl locale support and directly call the +system's setlocale function with C<LC_ALL>. + +This breaks both perl and modules such as JSON::XS, as stringification of +numbers no longer works correcly (e.g. C<$x = 0.1; print "$x"+1> might +print C<1>, and JSON::XS might output illegal JSON as JSON::XS relies on +perl to stringify numbers). + +The solution is simple: don't call C<setlocale>, or use it for only those +categories you need, such as C<LC_MESSAGES> or C<LC_CTYPE>. + +If you need C<LC_NUMERIC>, you should enable it only around the code that +actually needs it (avoiding stringification of numbers), and restore it +afterwards. + + =head1 BUGS While the goal of this module is to be correct, that unfortunately does diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-XS-2.32/XS.xs new/JSON-XS-2.34/XS.xs --- old/JSON-XS-2.32/XS.xs 2011-08-11 19:06:17.000000000 +0200 +++ new/JSON-XS-2.34/XS.xs 2013-05-23 11:23:11.000000000 +0200 @@ -74,6 +74,9 @@ # define JSON_STASH json_stash #endif +// the amount of HEs to allocate on the stack, when sorting keys +#define STACK_HES 64 + static HV *json_stash, *json_boolean_stash; // JSON::XS:: static SV *json_true, *json_false; @@ -594,11 +597,15 @@ if (count) { int i, fast = 1; -#if defined(__BORLANDC__) || defined(_MSC_VER) - HE **hes = _alloca (count * sizeof (HE)); -#else - HE *hes [count]; // if your compiler dies here, you need to enable C99 mode -#endif + HE *hes_stack [STACK_HES]; + HE **hes = hes_stack; + + // allocate larger arrays on the heap + if (count > STACK_HES) + { + SV *sv = sv_2mortal (NEWSV (0, count * sizeof (*hes))); + hes = (HE **)SvPVX (sv); + } i = 0; while ((he = hv_iternext (hv))) @@ -827,7 +834,7 @@ { // large integer, use the (rather slow) snprintf way. need (enc, IVUV_MAXCHARS); - enc->cur += + enc->cur += SvIsUV(sv) ? snprintf (enc->cur, IVUV_MAXCHARS, "%"UVuf, (UV)SvUVX (sv)) : snprintf (enc->cur, IVUV_MAXCHARS, "%"IVdf, (IV)SvIVX (sv)); @@ -839,7 +846,7 @@ encode_str (enc, "null", 4, 0); else croak ("encountered perl type (%s,0x%x) that JSON cannot handle, you might want to report this", - SvPV_nolen (sv), SvFLAGS (sv)); + SvPV_nolen (sv), (unsigned int)SvFLAGS (sv)); } static SV * @@ -1523,7 +1530,7 @@ SV *sv; /* work around bugs in 5.10 where manipulating magic values - * will perl ignore the magic in subsequent accesses. + * makes perl ignore the magic in subsequent accesses. * also make a copy of non-PV values, to get them into a clean * state (SvPV should do that, but it's buggy, see below). */ @@ -1607,7 +1614,7 @@ croak ("%s, at character offset %d (before \"%s\")", dec.err, - ptr_to_index (string, dec.cur), + (int)ptr_to_index (string, dec.cur), dec.cur != dec.end ? SvPV_nolen (uni) : "(end of string)"); } @@ -1807,7 +1814,7 @@ void new (char *klass) PPCODE: { - SV *pv = NEWSV (0, sizeof (JSON)); + SV *pv = NEWSV (0, sizeof (JSON)); SvPOK_only (pv); json_init ((JSON *)SvPVX (pv)); XPUSHs (sv_2mortal (sv_bless ( @@ -1894,7 +1901,7 @@ void filter_json_single_key_object (JSON *self, SV *key, SV *cb = &PL_sv_undef) PPCODE: { - if (!self->cb_sk_object) + if (!self->cb_sk_object) self->cb_sk_object = newHV (); if (SvOK (cb)) @@ -1915,18 +1922,22 @@ void encode (JSON *self, SV *scalar) PPCODE: - XPUSHs (encode_json (scalar, self)); + PUTBACK; scalar = encode_json (scalar, self); SPAGAIN; + XPUSHs (scalar); void decode (JSON *self, SV *jsonstr) PPCODE: - XPUSHs (decode_json (jsonstr, self, 0)); + PUTBACK; jsonstr = decode_json (jsonstr, self, 0); SPAGAIN; + XPUSHs (jsonstr); void decode_prefix (JSON *self, SV *jsonstr) PPCODE: { + SV *sv; char *offset; + PUTBACK; sv = decode_json (jsonstr, self, &offset); SPAGAIN; EXTEND (SP, 2); - PUSHs (decode_json (jsonstr, self, &offset)); + PUSHs (sv); PUSHs (sv_2mortal (newSVuv (ptr_to_index (jsonstr, offset)))); } @@ -1983,6 +1994,7 @@ if (GIMME_V != G_VOID) do { + SV *sv; char *offset; if (!INCR_DONE (self)) @@ -2006,7 +2018,8 @@ } } - XPUSHs (decode_json (self->incr_text, self, &offset)); + PUTBACK; sv = decode_json (self->incr_text, self, &offset); SPAGAIN; + XPUSHs (sv); self->incr_pos -= offset - SvPVX (self->incr_text); self->incr_nest = 0; @@ -2068,7 +2081,8 @@ JSON json; json_init (&json); json.flags |= ix; - XPUSHs (encode_json (scalar, &json)); + PUTBACK; scalar = encode_json (scalar, &json); SPAGAIN; + XPUSHs (scalar); } void decode_json (SV *jsonstr) @@ -2080,6 +2094,7 @@ JSON json; json_init (&json); json.flags |= ix; - XPUSHs (decode_json (jsonstr, &json, 0)); + PUTBACK; jsonstr = decode_json (jsonstr, &json, 0); SPAGAIN; + XPUSHs (jsonstr); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-XS-2.32/bin/json_xs new/JSON-XS-2.34/bin/json_xs --- old/JSON-XS-2.32/bin/json_xs 2010-08-18 01:26:27.000000000 +0200 +++ new/JSON-XS-2.34/bin/json_xs 2011-11-07 12:55:50.000000000 +0100 @@ -38,11 +38,17 @@ =item storable-file - a Storable file (Storable has two incompatible formats) +=item bencode - use Convert::Bencode, if available (used by torrent files, among others) + =item clzf - Compress::LZF format (requires that module to be installed) +=item eval - evaluate the given code as (non-utf-8) Perl, basically the reverse of "-t dump" + =item yaml - YAML (avoid at all costs, requires the YAML module :) -=item eval - evaluate the given code as (non-utf-8) Perl, basically the reverse of "-t dump" +=item string - do not attempt to decode te file data + +=item none - nothing is read, creates an C<undef> scalar - mainly useful with C<-e> =back @@ -66,6 +72,8 @@ =item storable-file - a Storable file in network format (Storable has two incompatible formats) +=item bencode - use Convert::Bencode, if available (used by torrent files, among others) + =item clzf - Compress::LZF format =item yaml - YAML @@ -74,16 +82,26 @@ =item dumper - Data::Dumper +=item string - writes the data out as if it were a string + +=item none - nothing gets written, mainly useful together with C<-e> + Note that Data::Dumper doesn't handle self-referential data structures correctly - use "dump" instead. =back +=item -e code + +Evaluate perl code after reading the data and before writing it out again +- can be used to filter, create or extract data. The data that has been +written is in C<$_>, and whatever is in there is written out afterwards. + =back =head1 EXAMPLES - json_xs -t null <isitreally.json + json_xs -t none <isitreally.json "JSON Lint" - tries to parse the file F<isitreally.json> as JSON - if it is valid JSON, the command outputs nothing, otherwise it will print an @@ -102,6 +120,14 @@ Same as above, but write YAML instead (not using JSON at all :) + json_xs -f none -e '$_ = [1, 2, 3]' + +Dump the perl array as UTF-8 encoded JSON text. + + <torrentfile json_xs -f bencode -e '$_ = join "\n", map @$_, @{$_->{"announce-list"}}' -t string + +Print the tracker list inside a torrent file. + lwp-request http://cpantesters.perl.org/show/JSON-XS.json | json_xs Fetch the cpan-testers result summary C<JSON::XS> and pretty-print it. @@ -123,6 +149,7 @@ my $opt_verbose; my $opt_from = "json"; my $opt_to = "json-pretty"; +my $opt_eval; Getopt::Long::Configure ("bundling", "no_ignore_case", "require_order"); @@ -130,9 +157,12 @@ "v" => \$opt_verbose, "f=s" => \$opt_from, "t=s" => \$opt_to, -) or die "Usage: $0 [-v] -f fromformat [-t toformat]\n"; + "e=s" => \$opt_eval, +) or die "Usage: $0 [-v] -f fromformat [-e code] [-t toformat]\n"; my %F = ( + "none" => sub { undef }, + "string" => sub { $_ }, "json" => sub { my $enc = /^\x00\x00\x00/s ? "utf-32be" @@ -145,13 +175,15 @@ }, "storable" => sub { Storable::thaw $_ }, "storable-file" => sub { open my $fh, "<", \$_; Storable::fd_retrieve $fh }, + "bencode" => sub { require Convert::Bencode; Convert::Bencode::bdecode ($_) }, "clzf" => sub { require Compress::LZF; Compress::LZF::sthaw ($_) }, "yaml" => sub { require YAML; YAML::Load ($_) }, "eval" => sub { my $v = eval "no strict; no warnings; no utf8;\n#line 1 \"input\"\n$_"; die "$@" if $@; $v }, ); my %T = ( - "null" => sub { "" }, + "none" => sub { "" }, + "string" => sub { $_ }, "json" => sub { encode_json $_ }, "json-utf-8" => sub { encode_json $_ }, "json-pretty" => sub { JSON::XS->new->utf8->pretty->encode ($_) }, @@ -163,6 +195,7 @@ "storable" => sub { Storable::nfreeze $_ }, "storable-file" => sub { open my $fh, ">", \my $buf; Storable::nstore_fd $_, $fh; $buf }, + "bencode" => sub { require Convert::Bencode; Convert::Bencode::bencode ($_) }, "clzf" => sub { require Compress::LZF; Compress::LZF::sfreeze_cr ($_) }, "yaml" => sub { require YAML; YAML::Dump ($_) }, "dumper" => sub { @@ -188,17 +221,21 @@ $T{$opt_to} or die "$opt_from: not a valid toformat\n"; -{ +if ($opt_from ne "none") { local $/; binmode STDIN; # stupid perl sometimes thinks its funny $_ = <STDIN>; } $_ = $F{$opt_from}->(); + +eval $opt_eval; +die $@ if $@; + $_ = $T{$opt_to}->(); binmode STDOUT; -print $_; +syswrite STDOUT, $_; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-XS-2.32/t/19_incr.t new/JSON-XS-2.34/t/19_incr.t --- old/JSON-XS-2.32/t/19_incr.t 2008-06-22 14:05:49.000000000 +0200 +++ new/JSON-XS-2.34/t/19_incr.t 2013-05-23 11:20:06.000000000 +0200 @@ -10,6 +10,9 @@ sub splitter { my ($coder, $text) = @_; + # work around hash randomisation bug introduced in 5.18 + $coder->canonical; + for (0 .. length $text) { my $a = substr $text, 0, $_; my $b = substr $text, $_; -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org