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

Question: dependency on unf_ext needed? #3

Open
ab opened this issue Apr 15, 2015 · 12 comments
Open

Question: dependency on unf_ext needed? #3

ab opened this issue Apr 15, 2015 · 12 comments

Comments

@ab
Copy link

ab commented Apr 15, 2015

I recently added a dependency on http-cookie to rest-client in order to better implement RFC compliant handling of cookies.

One issue that a large number of users seem to be running into is the dependency on unf_ext, which requires installing C compilers and libraries that otherwise would be unnecessary. Would there be any way to get a pure ruby solution here?

See rest-client/rest-client#371, for some example discussion.

@knu
Copy link
Owner

knu commented Apr 16, 2015

First of all, thanks for using http-cookie, and I regret any inconvenience it caused you and your users.

Ruby started to offer Unicode Nomalization starting from 2.2, so there would be a chance of getting the dependency on the native extension optional for Ruby >=2.2. All you have to do is define a version-specific dependency in a gemspec, and the easiest way would be to make unf_ext stop compiling itself and instead providing just a wrapper for the built-in Unicode Normalization API of Ruby. However, that's not ideal because it just takes away the alternative implementation of UN from the newer versions of Ruby. I'll have to find out a better way.

@knu
Copy link
Owner

knu commented Apr 16, 2015

I've just rolled out unf-0.2.0.beta1, which only builds and uses unf_ext on Ruby <2.2. If the trick used is proven to work, there's going to be an official release.

@bricedurand
Copy link

Not sure where I should post this but this discussion it's close enough so I'm commenting here.

I have a Rails app that has a dependency to rest_client 1.8.0. It has a dependency to domain_name 0.5.24, which depends on unf_ext 0.0.7.

Problem is unf_ext 0.0.7 has been yanked from rubygems a few days ago, so my deployment fails when trying to get this gem. I had to go back to an earlier version of rest-client (1.6.7) to fix it.
I'm guessing other gems depending on domain name 0.5.24 might face this issue.

@knu
Copy link
Owner

knu commented Apr 21, 2015

What gem has the fixed dependency on unf_ext 0.0.7? domain_name 0.5.24 has gem.add_runtime_dependency("unf", ["< 1.0.0", ">= 0.0.5"]) in its gemspec.
https://rubygems.org/gems/domain_name/versions/0.5.24

@knu
Copy link
Owner

knu commented Apr 21, 2015

...And unf does not name any specific version of unf_ext.
https://rubygems.org/gems/unf

@bricedurand
Copy link

Yeah that surprised me as well but 0.0.7 is the version set after running bundle install.
Anyway no big deal I worked around it, just letting you know.

@knu
Copy link
Owner

knu commented Apr 21, 2015

@bricedurand Ah, I didn't read your comment carefully. I feel really sorry for that, as unf_ext 0.0.7 had been there only for a couple of hours until I uploaded 0.0.7.1. Please try gem update unf_ext and then bundle update unf_ext or something like that next time.

@knu
Copy link
Owner

knu commented Apr 21, 2015

I haven't answered the original question. The answer is yes; DomainName is a library to deal with domain names including IDN/IDNA, so it must perform Unicode Normalization in NFC and NFKC as required by the related RFCs and Unicode Specification.

@ab
Copy link
Author

ab commented Apr 23, 2015

Got it, that makes sense. (http-cookie and domain_name are both really great, by the way.)

I'll give it a try on ruby 2.2.

@databus23
Copy link

@knu any plans on bumping unf 0.2.0 from beta to stable? its been almost a year now.

@ab
Copy link
Author

ab commented Oct 20, 2016

👍

@knu
Copy link
Owner

knu commented Oct 20, 2016

Actually in 2.2 Ruby introduced a built-in library called unicode_normalize, so I think next time I major-update those gems dropping support for ruby <2.2, I'd rather drop the dependencies. Ruby-unf(_ext) has served its purpose.

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

No branches or pull requests

4 participants