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

Is it possible to unconstrain strscan or fallback if not available? #132

Closed
adsr opened this issue May 17, 2024 · 6 comments
Closed

Is it possible to unconstrain strscan or fallback if not available? #132

adsr opened this issue May 17, 2024 · 6 comments

Comments

@adsr
Copy link

adsr commented May 17, 2024

Hello, as I understand it, strscan is a standard gem which means Ruby will always include some version of it. One can update the version via gem, but then it must be compiled on the target system as it isn't provided as a binary gem. Recent versions of strscan seem to require a Ruby compiled with libonig support[1], which may not be available. If I'm understanding all of this correctly, this effectively limits the kinds of Ruby installs where rexml can be used. (EDIT: I misinterpreted log output. libonig is optional. As mentioned here, workarounds include ensuring build-essential is installed (gcc and make) or using an earlier version of rexml as mentioned below.)

If your gem directly requires rexml, the easiest way to get around this is to require an earlier version of rexml that doesn't use strscan (e.g., 3.2.6). This isn't a great solution as we miss out on updates. And if rexml is further down the dependency chain, even this may not be viable.

  • Does rexml need to constrain the version of strscan? Could we leave it unpinned for better compatibility? (Potentially related to 372daf1)
  • If the version constraint is needed, can rexml fallback to the old routines if the correct strscan version is unavailable? (or something that uses an earlier version of strscan?)

Apologies if I'm off the mark. By no means a Ruby expert.

[1] https://github.com/ruby/strscan/blob/ca66d48c47d2b17753a660c628606f0bf788d594/ext/strscan/extconf.rb#L5-L6

@adsr
Copy link
Author

adsr commented May 17, 2024

Sorry, just saw #131 which is exactly what prompted this issue on our end. Feel free to close, but I'm still curious about the questions I raised. Thanks.

@kou
Copy link
Member

kou commented May 17, 2024

Does rexml need to constrain the version of strscan? Could we leave it unpinned for better compatibility?

@naitoh Can we use old strscan? See also: #105 (comment)

@kou kou closed this as completed in f1df7d1 May 21, 2024
@kou
Copy link
Member

kou commented May 21, 2024

I've implemented this.

@naitoh
Copy link
Contributor

naitoh commented May 21, 2024

Does rexml need to constrain the version of strscan? Could we leave it unpinned for better compatibility?

@naitoh Can we use old strscan? See also: #105 (comment)

@kou

I fixed the problem with StringScanner#captures at ruby/strscan#72.

So you will need to use StringScanner that incorporates this fix, but I think f1df7d1 should be fine.
Thank you!

However, I am concerned about the impact of the ruby/strscan#79 modification on JRuby, is that a problem?

See: https://github.com/ruby/rexml/pull/105/files#r1451192655

@kou
Copy link
Member

kou commented May 21, 2024

I think that JRuby users can use the latest strscan or upgrade JRuby itself. strscan gem for JRuby is a fat gem. So JRuby users don't need to build it.

@naitoh
Copy link
Contributor

naitoh commented May 22, 2024

@kou

I think that JRuby users can use the latest strscan or upgrade JRuby itself. strscan gem for JRuby is a fat gem. So JRuby users don't need to build it.

OK.
I see.
Thanks!

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

No branches or pull requests

3 participants