Raised "The file '/usr/share/zoneinfo/timeconfig' does not start with the expected header." #64

Closed
snmgian opened this Issue Jan 12, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@snmgian

snmgian commented Jan 12, 2017

The Slackware Linux distribution includes a script named timeconfig inside the zoneinfo directory.

That file is not being excluded by #load_timezone_index: https://github.com/tzinfo/tzinfo/blob/master/lib/tzinfo/zoneinfo_data_source.rb#L344

So, when doing this:

TZInfo::Timezone.all.find_all {|tz| tz.current_period.abbreviation == :some_abbrev }

will raise this error:

TZInfo::InvalidTimezoneIdentifier: The file '/usr/share/zoneinfo/timeconfig' does not start with the expected header.
	from /home/gian/.rbenv/versions/2.3.0/gemsets/r/gems/tzinfo-1.2.2/lib/tzinfo/zoneinfo_data_source.rb:205:in `rescue in load_timezone_info'
	from /home/gian/.rbenv/versions/2.3.0/gemsets/r/gems/tzinfo-1.2.2/lib/tzinfo/zoneinfo_data_source.rb:202:in `load_timezone_info'
	from /home/gian/.rbenv/versions/2.3.0/gemsets/r/gems/tzinfo-1.2.2/lib/tzinfo/timezone.rb:92:in `get'
	from /home/gian/.rbenv/versions/2.3.0/gemsets/r/gems/tzinfo-1.2.2/lib/tzinfo/timezone_proxy.rb:67:in `real_timezone'
	from /home/gian/.rbenv/versions/2.3.0/gemsets/r/gems/tzinfo-1.2.2/lib/tzinfo/timezone_proxy.rb:30:in `period_for_utc'
	from /home/gian/.rbenv/versions/2.3.0/gemsets/r/gems/tzinfo-1.2.2/lib/tzinfo/timezone.rb:549:in `current_period'
	from (irb):12:in `block in irb_binding'
	from (irb):12:in `each'
	from (irb):12:in `find_all'
	from (irb):12
	from /home/gian/.rbenv/versions/2.3.0/bin/irb:11:in `<main>'

I can send a PR if you are ok to excluding that file. Thanks.

@philr philr closed this in de9f4bc Jan 12, 2017

@philr

This comment has been minimized.

Show comment
Hide comment
@philr

philr Jan 12, 2017

Member

Thank you for the report.

I've committed a change to ignore the timeconfig symlink.

Member

philr commented Jan 12, 2017

Thank you for the report.

I've committed a change to ignore the timeconfig symlink.

philr added a commit that referenced this issue Mar 19, 2017

@philr

This comment has been minimized.

Show comment
Hide comment
@philr

philr Mar 25, 2017

Member

The fix for this issue has now been released in version 1.2.3.

Member

philr commented Mar 25, 2017

The fix for this issue has now been released in version 1.2.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment