-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Psych 1.2.1 not Compatible with Ruby 1.9.2 #32
Comments
In fact, Psych's own test suite fails:
|
I'm running on Ruby 1.9.2-p290. Looking at things (http://redmine.ruby-lang.org/issues/3778), it looks like the %:z specifier in strftime is only defined in Ruby 1.9.3 and higher. This means that Psych 1.2.1 does not work and in fact, can screw things up pretty badly in Ruby 1.9.2 and earlier. |
In addition, the lib/psych/visitors/to_ruby.rb file references the constant Regexp::NOENCODING which is not defined in Ruby 1.9.2, it makes it's appearance in Ruby 1.9.3 I don't think this is a huge problem other than a failing spec, as in Ruby 1.9.2 you can't create a regex with the noencoding flag in 1.9.2. It would cause an exception if a YAML file was generated on Ruby 1.9.3 and then parsed in Ruby 1.9.2. |
This was fixed in 1.2.2. |
I just upgraded to Psych 1.2.1 and ran into a problem with serializing times in my Rails app. Essentially serialize/deserialize roundtrips were losing their timezone information.
A look at my rails log shows some weirdness:
INSERT INTO$HeadURL$ \n:svn_rev: $Rev$ \n:version_txt: $HeadURL$ \n:start_job_time: 0.013328075408935547\n:start_job_calls: 1\n:updating_running_jobs_time: 0.0029239654541015625\n:updating_running_jobs_calls: 1\n:get_job_datetime_time: 9.489059448242188e-05\n:get_job_datetime_calls: 1\n:etl_errors: 1\n:tt_incr_skipped_increments: 1\n:soft_aborts: 1\n:parse_time: 0.031224966049194336\n:parse_calls: 1\n:max_ticket_timestamp: 2011-10-03 18:43:58.667334000 %:z\n:tt_import_next_params:\n :last_timestamp: 2011-10-03 18:43:58.667334000 %:z\n :next_row: 1\n :max_rows: 2000\n :job_type: :incremental\n:start_job_average_time: 0.013328075408935547\n:updating_running_jobs_average_time: 0.0029239654541015625\n:get_job_datetime_average_time: 9.489059448242188e-05\n:parse_average_time: 0.031224966049194336\n', 'eds-big-laptop.lan', 82462)
etl_logs
(job_name
,last_run_date
,last_run_time
,last_run
,rows_processed
,job_errors
,rows_imported
,run_time
,stats
,created_at
,updated_at
,additional_data
,hostname
,pid
) VALUES('Incremental import of TT tickets', '2011-10-03', '2011-10-03 12:19:58', '2011-10-03 12:19:58', NULL, 0, NULL, 0, NULL, '2011-10-03 12:22:17', '2011-10-03 12:22:17', '---\n:timestamp: 0.040103\n:svn_version:Note the :last_timestamp field about 3/4 of the way through; it ends "%:z" rather than the UTC offset..
A quick grep and the culprit is found in lib/psych/visitors/yaml_tree.rb line 311. There is a spare colon hanging around in the format string of the strftime.
I'll have a patch with tests shortly.
The text was updated successfully, but these errors were encountered: