Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: JRuby 0.9.9
-
Component/s: Extensions
-
Labels:None
-
Environment:Using JRuby built from Subversion trunk (revision 3415) on 2007-04-10.
Mac OS X Tiger. Java version 1.5.0_07.
-
Testcase included:yes
-
Number of attachments :
Description
Writing large data structures as YAML seem to give incorrect result sometimes. I have not been able to narrow this down to a small example. Instead I give the large testcase "as-is".
I supply the testcase in two formats: 1) traditional "test/unit" testcase, and 2) a Rakefile that will generate the test-vectors as files. This second approach makes it easier (I think) to see what goes wrong.
The second approach works by: 1) let a script generate YAML-files with both CRuby and JRuby. 2) let a CRuby script rewrite the YAML-files to a canonical format (invented for this bug-report). This step is needed to eliminate the different YAML-constructs used by the YAML-library in CRuby and JRuby. 3) compare with diff(1) the files on canonical format. 4) For the YAML-library in JRuby to be OK, there should not be any differences.
The suppiled Rakefile makes running the tests easy:
$ rake gen
$ rake diff
Om my machine the diff-step gives the output below. I would have expected no differences if the YAML-library worked OK in JRuby.
To make the tests use even larger data structures, the constant COUNT in the "gen-yaml-samples.rb" file can be increased.
Below is the output I get on my machine from running the rake-tasks described above.
--------------------------
diff r -x '*.yaml' build/rubycompare/x/050.yaml.serial build/jruby-compare/x/050.yaml.serial
253c253
< String: nn2586
—
> String: nn2566
diff r -x '*.yaml' build/rubycompare/y/074.yaml.serial build/jruby-compare/y/074.yaml.serial
2257c2257
< String: BB
—
> String: bb
diff r -x '*.yaml' build/rubycompare/y/078.yaml.serial build/jruby-compare/y/078.yaml.serial
1162c1162,1163
< String: nn40933
—
> Array:
> String: nn40706
rake aborted!
--------------------------
Is this something that has caused problems in an application?
There is bound to be differences, since Syck and JvYAML are completely different YAML engines; but this shouldn't have any effect on functionality.