relaton / relaton-iec

IecBib: retrieve IEC/CIE Standards for bibliographic use using the BibliographicItem model
MIT License
1 stars 0 forks source link

No such file or directory @ rb_sysopen - lib/relaton_iec/statuses.yml (Errno::ENOENT) #25

Closed CAMOBAP closed 3 years ago

CAMOBAP commented 3 years ago

Problem

/__enclose_io_memfs__/lib/ruby/2.4.0/psych.rb:472:in `initialize': No such file or directory @ rb_sysopen - lib/relaton_iec/statuses.yml (Errno::ENOENT)
    from /__enclose_io_memfs__/lib/ruby/2.4.0/psych.rb:472:in `open'
    from /__enclose_io_memfs__/lib/ruby/2.4.0/psych.rb:472:in `load_file'
    from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/relaton-iec-1.7.1/lib/relaton_iec/scrapper.rb:173:in `fetch_status'
    from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/relaton-iec-1.7.1/lib/relaton_iec/scrapper.rb:229:in `fetch_status_relations'
    from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/relaton-iec-1.7.1/lib/relaton_iec/scrapper.rb:42:in `parse_page'
    from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/relaton-iec-1.7.1/lib/relaton_iec/hit.rb:9:in `fetch'
    from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/relaton-iec-1.7.1/lib/relaton_iec/iec_bibliography.rb:82:in `block in fetch_pages'
    from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/relaton-bib-1.7.0/lib/relaton_bib/workers_pool.rb:19:in `block (2 levels) in worker'

Full log here https://github.com/metanorma/packed-mn/runs/1479616555?check_suite_focus=true#step:6:2703

Proposed solution

This happens only for rubyc packed app because rubyc pack everything on inmemory fs /__enclose_io_memfs__/

To fix this we need to load the file by the relative path like this File.join(File.dirname(self.class::_file || __FILE__), 'statuses.yml')

ronaldtse commented 3 years ago

Thanks @CAMOBAP . @andrew2net I would suggest you to directly read that file in Ruby code when defining classes as a constant. There is no need to load this file on runtime.

ronaldtse commented 3 years ago

@andrew2net could we have a new release after this fix? We need it for packed-mn. Thanks!

ronaldtse commented 3 years ago

Thanks @andrew2net - ping @CAMOBAP this is fixed and released.