Skip to content

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

@snmgian

Description

@snmgian

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions