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

http-parser fails to build in current directory: /var/lib/gems/3.0.0/gems/http-parser-1.2.3/ext #17

Open
erwinwolff opened this issue Mar 23, 2022 · 2 comments

Comments

@erwinwolff
Copy link

erwinwolff commented Mar 23, 2022

I have this weird error. When I do something like this gem install http-parser --platform=ruby

I get the output

Building native extensions. This could take a while...
ERROR:  Error installing http-parser:
	ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/3.0.0/gems/http-parser-1.2.3/ext
/usr/bin/ruby -I/usr/lib/ruby/site_ruby/3.0.0 -rrubygems /var/lib/gems/3.0.0/gems/rake-13.0.6/exe/rake RUBYARCHDIR\=/var/lib/gems/3.0.0/extensions/x86_64-linux/3.0.0-static/http-parser-1.2.3 RUBYLIBDIR\=/var/lib/gems/3.0.0/extensions/x86_64-linux/3.0.0-static/http-parser-1.2.3
rake aborted!
ArgumentError: wrong number of arguments (given 2, expected 1)
/var/lib/gems/3.0.0/gems/rake-13.0.6/exe/rake:27:in `<main>'
Tasks: TOP => default => x86_64-linux/libhttp-parser-ext.so => x86_64-linux/http-parser/http_parser.o => x86_64-linux/http-parser
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in /var/lib/gems/3.0.0/gems/http-parser-1.2.3 for inspection.
Results logged to /var/lib/gems/3.0.0/extensions/x86_64-linux/3.0.0-static/http-parser-1.2.3/gem_make.out

HOWEVER ....

When I go to the directory /var/lib/gems/3.0.0/gems/http-parser-1.2.3/ (note that I dont include the /ext/ part)

And I execute the command
/usr/bin/ruby -I/usr/lib/ruby/site_ruby/3.0.0 -rrubygems /var/lib/gems/3.0.0/gems/rake-13.0.6/exe/rake RUBYARCHDIR=/var/lib/gems/3.0.0/extensions/x86_64-linux/3.0.0-static/http-parser-1.2.3 RUBYLIBDIR=/var/lib/gems/3.0.0/extensions/x86_64-linux/3.0.0-static/http-parser-1.2.3

I get the correct output:

mkdir -p x86_64-linux/http-parser
gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -Wextra -O3 -fPIC   -o x86_64-linux/http-parser/http_parser.o -c ./http-parser/http_parser.c
gcc -shared -o x86_64-linux/libhttp-parser-ext.so x86_64-linux/http-parser/http_parser.o -fexceptions
/usr/bin/ruby -I/var/lib/gems/3.0.0/gems/rspec-support-3.11.0/lib:/var/lib/gems/3.0.0/gems/rspec-core-3.11.0/lib /var/lib/gems/3.0.0/gems/rspec-core-3.11.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
..................................

Finished in 0.02042 seconds (files took 0.21255 seconds to load)
34 examples, 0 failures

in the /var/lib/gems/3.0.0/gems/http-parser-1.2.3/ext directory I get the above output again.

So I think there might be something wrong with the packaging

@jirutka
Copy link

jirutka commented Aug 13, 2022

The built native extensions should be installed into $GEM_HOME/extensions/<platform>/<ruby-abi>/<gem-name>-<gem-version>, but this gem installs it into $GEM_HOME/gems/<gem-name>-<gem-version>/ext/<platform>.

@jirutka
Copy link

jirutka commented Aug 13, 2022

Moreover, it bundles an ancient version of the http-parser library that contains multiple vulnerabilities and it doesn’t even try to use a system-provided libhttp-parser. This gem is dangerous.

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

2 participants