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

Added 'mini_portile2' #2995

Closed
wants to merge 1 commit into from
Closed

Conversation

D3vil0p3r
Copy link

Added gem 'mini_portile2' because it is needed for nokogiri. Tested on NixOS by using bundle install and bundix to generate gemset.nix and build Beef on Nix. This change prevents error by nokogiri.

Pull Request

Thanks for submitting a PR! Please fill in this template where appropriate:

Category

e.g. Bug, Module, Extension, Core Functionality, Documentation, Tests

Feature/Issue Description

Q: Please give a brief summary of your feature/fix
A:

Q: Give a technical rundown of what you have changed (if applicable)
A:

Test Cases

Q: Describe your test cases, what you have covered and if there are any use cases that still need addressing.
A:

Wiki Page

If you are adding a new feature that is not easily understood without context, please draft a section to be added to the Wiki below.

Added `gem 'mini_portile2'` because it is needed for `nokogiri`. Tested on NixOS by using `bundle install` and `bundix` to generate `gemset.nix` and build Beef on Nix. This change prevents error by nokogiri.
@D3vil0p3r D3vil0p3r had a problem deploying to Integrate Pull Request December 27, 2023 01:19 — with GitHub Actions Failure
@stephenakq stephenakq self-assigned this Dec 31, 2023
@stephenakq
Copy link
Collaborator

stephenakq commented Dec 31, 2023

Thank you @D3vil0p3r. What was the error on NixOS?

@D3vil0p3r
Copy link
Author

During the building of beef package in Nix, if mini_portile2 dependency is not added inside Gemfile, the user gets:

This could take a while...
ERROR:  Error installing /nix/store/aps89z30hgi410g38xli737dy75v9i4a-nokogiri-1.16.0.gem:
        ERROR: Failed to build gem native extension.

    current directory: /nix/store/amdv92gjx3g0sdqq09wxxnrq3p49azc5-ruby3.1.4-nokogiri-1.16.0/lib/ruby/gems/3.1.0/gems/nokogiri-1.16.0/ext/nokogiri
/nix/store/2kw126cy93rix4pmh9lcl120njnb6r7r-ruby-3.1.4/bin/ruby extconf.rb --use-system-libraries --with-zlib-lib\=/nix/store/8xgb8phqmfn9h971q7dg369h647i1aa0-zlib-1.3/lib --with-zlib-include\=/nix/store/9a4ivnm2hwggi6qjg0gcpk05f5hsw5r5-zlib-1.3-dev/include --with-xml2-lib\=/nix/store/8iqf3yxqy256rsr7zqb1w0i503qxws12-libxml2-2.11.5/lib --with-xml2-include\=/nix/store/qr95q8fnpn7jfmh8bv5q560vxy332s2z-libxml2-2.11.5-dev/include/libxml2 --with-xslt-lib\=/nix/store/v5bb581711pfyx0025scdyq5gmpz4ji6-libxslt-1.1.38/lib --with-xslt-include\=/nix/store/3n251m8khpzvsm577qf5s82pra3rmfxj-libxslt-1.1.38-dev/include --with-exslt-lib\=/nix/store/v5bb581711pfyx0025scdyq5gmpz4ji6-libxslt-1.1.38/lib --with-exslt-include\=/nix/store/3n251m8khpzvsm577qf5s82pra3rmfxj-libxslt-1.1.38-dev/include
checking for whether -std=c99 is accepted as CFLAGS... yes
checking for whether -Wno-declaration-after-statement is accepted as CFLAGS... yes
checking for whether -O2 is accepted as CFLAGS... yes
checking for whether -g is accepted as CFLAGS... yes
checking for whether -Winline is accepted as CFLAGS... yes
checking for whether -Wmissing-noreturn is accepted as CFLAGS... yes
checking for whether -Wconversion -Wno-sign-conversion is accepted as CFLAGS... yes
Building nokogiri using system libraries.
checking for gzdopen() in -lz... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... yes
checking for exsltFuncRegister() in -lexslt... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/nix/store/2kw126cy93rix4pmh9lcl120njnb6r7r-ruby-3.1.4/bin/$(RUBY_BASE_NAME)
        --help
        --clean
        --prevent-strip
        --enable-system-libraries
        --disable-system-libraries
        --use-system-libraries
        --enable-system-libraries
        --disable-system-libraries
        --use-system-libraries
        --with-zlib-dir
        --without-zlib-dir
        --with-zlib-include=${zlib-dir}/include
        --with-zlib-lib=${zlib-dir}/lib
        --with-z-dir
        --without-z-dir
        --with-z-include
        --without-z-include=${z-dir}/include
        --with-z-lib
        --without-z-lib=${z-dir}/lib
        --with-zlib
        --without-zlib
        --with-xml2-dir
        --without-xml2-dir
        --with-xml2-include=${xml2-dir}/include
        --with-xml2-lib=${xml2-dir}/lib
        --with-xml2lib
        --without-xml2lib
        --with-xslt-dir
        --without-xslt-dir
        --with-xslt-include=${xslt-dir}/include
        --with-xslt-lib=${xslt-dir}/lib
        --with-xsltlib
        --without-xsltlib
        --with-exslt-dir
        --without-exslt-dir
        --with-exslt-include=${exslt-dir}/include
        --with-exslt-lib=${exslt-dir}/lib
        --with-exsltlib
        --without-exsltlib
/nix/store/2kw126cy93rix4pmh9lcl120njnb6r7r-ruby-3.1.4/lib/ruby/3.1.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'mini_portile2' (~> 2.8.2) among 86 total gem(s) (Gem::MissingSpecError)

To solve this is needed not only to add mini_portile2 in Gemfile, but also be sure that mini_portile2 appears as dependency of nokogiri inside Gemfile.lock when generated by bundle install, because I noted that, if I add mini_portile2 inside Gemfile and then I run bundle install, the resulting Gemfile.lock is:

mini_portile2 (2.8.5)
...
nokogiri (1.16.0-x86_64-linux)
  racc (~> 1.4)
...

So, the user must manually edit the Gemfile.lock to add:

nokogiri (1.16.0-x86_64-linux)
  racc (~> 1.4)
  mini_portile2 (2.8.5)

and in this manner it works. I don't know if it is possible to edit the Gemfile in order to make mini_portile2 to be/to appear in Gemfile.lock as a dependency of nokogiri.

@D3vil0p3r
Copy link
Author

@stephenakq

@stephenakq
Copy link
Collaborator

Thank you. I have it on my list. You can also join our discord server to discuss https://discord.gg/ugmKmHarKc

Copy link
Contributor

Stale pull request message

@D3vil0p3r
Copy link
Author

Up: not stale

@stephenakq
Copy link
Collaborator

Thank you @D3vil0p3r. Do you know a different method to using the mini_portile2 gem? It seems to have a lot of runtime functionality? I don't want to increase the attack surface.

@D3vil0p3r
Copy link
Author

The only idea I have currently is to remove the usage of nokogiri (so miniportal is not needed anymore) and replace it with another dep if needed. Also because in general nokogiri seems to create only issues.

@stephenakq
Copy link
Collaborator

This is going to be a bigger change. Can you join discord so we can discuss https://discord.gg/ugmKmHarKc

@stephenakq stephenakq closed this Jan 19, 2024
@D3vil0p3r
Copy link
Author

Already there

@D3vil0p3r D3vil0p3r deleted the patch-1 branch January 19, 2024 19:57
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 this pull request may close these issues.

2 participants