Skip to content
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

syntax error after update version 3.4.0 #159

Closed
yalanin opened this issue Nov 16, 2021 · 3 comments · Fixed by #160
Closed

syntax error after update version 3.4.0 #159

yalanin opened this issue Nov 16, 2021 · 3 comments · Fixed by #160
Assignees
Labels

Comments

@yalanin
Copy link

yalanin commented Nov 16, 2021

Hello:
Our Project raise syntax error after update version 3.4.0 today, the following is the error message it has showed:

/mime-types-3.4.0/lib/mime/types/cache.rb:26: syntax error, unexpected tIDENTIFIER, expecting '(' (SyntaxError)
Could not load MIME::Types cache: invalid version
/mime-types-3.4.0/lib/mime/types/cache.rb:32: syntax error, unexpected tIDENTIFIER, expecting '('
Could not load MIME::Types cache: #{e}

We try to add " in line 26 and 32 in cache.rb:

MIME::Types.logger.warn <<~WARNING.chomp
    "Could not load MIME::Types cache: invalid version"
WARNING
MIME::Types.logger.warn <<~WARNING.chomp
   "Could not load MIME::Types cache: #{e}"
WARNING

and it appear another error:

/mime/types/registry.rb:49: syntax error, unexpected tIDENTIFIER, expecting keyword_end (SyntaxError)
($RUBY_MIME_TYPES_LAZY_LOAD) is deprecated and will be remov...

and so do we to registry.rb in line 49, it works:

MIME::Types.logger.warn <<~WARNING.chomp
   "Lazy loading ($RUBY_MIME_TYPES_LAZY_LOAD) is deprecated and will be removed."
WARNING

we are not sure this is right way to fix the error or not, could you please help us confirm this issue? Thank You!

Best Regard!

@electrofelix
Copy link

Looks to me like release 3.4.0 is using syntax that is not supported by ruby < 2.3?

https://github.com/vagrant-libvirt/vagrant-libvirt/runs/4217516069?check_suite_focus=true

Rather than try to fix the syntax, should https://github.com/mime-types/ruby-mime-types/blob/main/mime-types.gemspec#L20 be updated to reference 2.3 as the minimum version rather than 2.0? Assuming it's possible do a bugfix release and yank 3.4.0 so that installs on older rubies for some older distros will ignore the more recent releases?

While 2.2 is no longer supported for security fixes by the security developers, ruby 2.0 is in centos 7 which has security updates until 2024.

@halostatue
Copy link
Member

I will do a bug fix release with this. I won’t be yanking 3.4.0 (for reasons), but this should be quickly addressable.

@halostatue halostatue self-assigned this Nov 16, 2021
@halostatue halostatue added the Bug label Nov 16, 2021
halostatue added a commit that referenced this issue Nov 16, 2021
Fixed a Ruby &lt; 2.3 incompatibility introduced by the use of
standardrb, where `<<-` heredocs were converted to `<<~` heredocs. These
have been reverted back to `<<-` with the indentation kept and
a `.strip` call to prevent excess whitespace.

Resolves #159
@halostatue
Copy link
Member

mime-types 3.4.1 has been released and should fix this. Please advise if it does not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants