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

NameError: uninitialized constant File::SHARE_DELETE #3745

Closed
n-rodriguez opened this issue Dec 14, 2024 · 7 comments
Closed

NameError: uninitialized constant File::SHARE_DELETE #3745

n-rodriguez opened this issue Dec 14, 2024 · 7 comments

Comments

@n-rodriguez
Copy link

Hi there!

logger gem has been released with support of log file rotation on Windows (ruby/logger@7b6146f) and now CI fails :

Backtrace :

NameError:
  uninitialized constant File::SHARE_DELETE
# ./vendor/bundle/truffleruby/3.2.4.24.1.0.1/gems/logger-1.6.3/lib/logger/log_device.rb:73:in `const_missing'
# ./vendor/bundle/truffleruby/3.2.4.24.1.0.1/gems/logger-1.6.3/lib/logger/log_device.rb:73:in `<class:LogDevice>'
# ./vendor/bundle/truffleruby/3.2.4.24.1.0.1/gems/logger-1.6.3/lib/logger/log_device.rb:7:in `<class:Logger>'
# ./vendor/bundle/truffleruby/3.2.4.24.1.0.1/gems/logger-1.6.3/lib/logger/log_device.rb:5:in `<top (required)>'
# ./vendor/bundle/truffleruby/3.2.4.24.1.0.1/gems/logger-1.6.3/lib/logger.rb:19:in `<top (required)>'
# ./vendor/bundle/truffleruby/3.2.4.24.1.0.1/gems/faraday-2.12.2/lib/faraday/response/logger.rb:4:in `<top (required)>'
# ./vendor/bundle/truffleruby/3.2.4.24.1.0.1/gems/faraday-2.12.2/lib/faraday/response.rb:90:in `<top (required)>'
# ./vendor/bundle/truffleruby/3.2.4.24.1.0.1/gems/faraday-2.12.2/lib/faraday.rb:19:in `<top (required)>'
# ./lib/ovh_rest.rb:7:in `<top (required)>'
# ./lib/ovh-rest.rb:3:in `<top (required)>'
# ./spec/spec_helper.rb:28:in `<top (required)>'
# ./spec/ovh_rest/client_spec.rb:3:in `<top (required)>'
No examples found.

It seems that File::SHARE_DELETE is only available on Windows in Truffleruby : https://github.com/oracle/truffleruby/blob/master/spec/ruby/core/file/shared/unlink.rb#L51

Thank you!

@andrykonchin
Copy link
Member

Yeah, indeed. Thank you!

File::SHARE_DELETE is meaningful only on Windows and has 0 value on other platforms. And TruffleRuby does not declare it at all as far as Windows is not supported. But it seems this is incorrect and the constant should be declared.

@andrykonchin
Copy link
Member

Fixed in 08fdec7

@ksr-13
Copy link

ksr-13 commented Dec 30, 2024

I have
ruby -v
truffleruby 24.2.0-dev-01ebb356, like ruby 3.3.5, GraalVM CE Native [arm64-darwin23]
installed via rvm.
I am getting the error
truffleruby-head@TR/gems/logger-1.6.3/lib/logger/log_device.rb:73:in `const_missing': uninitialized constant File::SHARE_DELETE (NameError)

What is the workaround till 24.2.0 release?

@andrykonchin
Copy link
Member

andrykonchin commented Dec 30, 2024

Looks like the truffleruby 24.2.0-dev-01ebb356 version doesn't contain the fix.

The SHA1 01ebb356 points at commit 01ebb35 that was merged on Dec 10, 2024. But a commit with the fix is 08fdec7 that was created on Dec 16, 2024.

As a workaround I would check other Ruby version managers - whether they provide a way to install a fresher dev build.

Dev builds are also available on Github - installation details are described in the following document - https://github.com/oracle/truffleruby/blob/master/doc/user/installing-truffleruby.md.

@n-rodriguez
Copy link
Author

What is the workaround till 24.2.0 release?

@ksr-13 https://github.com/ONLYOFFICE-QA/ooxml_parser/pull/1427/files

@eregon
Copy link
Member

eregon commented Jan 9, 2025

We should add truffleruby to ruby/logger CI and propose a workaround there so it works on the current release.
@andrykonchin Can you do that?

@andrykonchin
Copy link
Member

A workaround in the logger gem was merged (ruby/logger#114). So the next logger release will work properly on the current TruffleRuby release (24.1)

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

No branches or pull requests

4 participants