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

1.6.2 install: "Failed to complete patch task" #1095

Closed
mattbrictson opened this issue May 13, 2014 · 18 comments
Closed

1.6.2 install: "Failed to complete patch task" #1095

mattbrictson opened this issue May 13, 2014 · 18 comments

Comments

@mattbrictson
Copy link

1.6.1 installs fine, but 1.6.2 fails while patching. I'm on Mac OS X Mavericks.

$ ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
$ gem install nokogiri -v '1.6.2'
Building native extensions.  This could take a while...
Building nokogiri using packaged libraries.
Building libxml2-2.8.0 for nokogiri with the following patches applied:
    - 0001-Fix-parser-local-buffers-size-problems.patch
    - 0002-Fix-entities-local-buffers-size-problems.patch
    - 0003-Fix-an-error-in-previous-commit.patch
    - 0004-Fix-potential-out-of-bound-access.patch
    - 0005-Detect-excessive-entities-expansion-upon-replacement.patch
    - 0006-Do-not-fetch-external-parsed-entities.patch
    - 0007-Enforce-XML_PARSER_EOF-state-handling-through-the-pa.patch
    - 0008-Improve-handling-of-xmlStopParser.patch
    - 0009-Fix-a-couple-of-return-without-value.patch
    - 0010-Keep-non-significant-blanks-node-in-HTML-parser.patch
    - 0011-Do-not-fetch-external-parameter-entities.patch
************************************************************************
IMPORTANT!  Nokogiri builds and uses a packaged version of libxml2.

[snip]

Running 'patch' for libxml2 2.8.0... ERROR, review 'tmp/x86_64-apple-darwin13.1.0/ports/libxml2/2.8.0/patch.log' to see what happened.
*** 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=/Users/mbrictson/.rbenv/versions/2.1.2/bin/ruby
    --help
    --clean
    --use-system-libraries
    --enable-static
    --disable-static
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --enable-cross-build
    --disable-cross-build
/Users/mbrictson/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mini_portile-0.5.3/lib/mini_portile.rb:278:in `block in execute': Failed to complete patch task (RuntimeError)
    from /Users/mbrictson/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mini_portile-0.5.3/lib/mini_portile.rb:270:in `chdir'
    from /Users/mbrictson/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mini_portile-0.5.3/lib/mini_portile.rb:270:in `execute'
    from /Users/mbrictson/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mini_portile-0.5.3/lib/mini_portile.rb:47:in `block in patch'
    from /Users/mbrictson/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mini_portile-0.5.3/lib/mini_portile.rb:44:in `each'
    from /Users/mbrictson/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mini_portile-0.5.3/lib/mini_portile.rb:44:in `patch'
    from /Users/mbrictson/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mini_portile-0.5.3/lib/mini_portile.rb:107:in `cook'
    from extconf.rb:247:in `block in process_recipe'
    from extconf.rb:176:in `tap'
    from extconf.rb:176:in `process_recipe'
    from extconf.rb:364:in `<main>'
$ cat tmp/x86_64-apple-darwin13.1.0/ports/libxml2/2.8.0/patch.log
/Users/mbrictson/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.2/ports/patches/libxml2/0010-Keep-non-significant-blanks-node-in-HTML-parser.patch:170: trailing whitespace.
<html>
/Users/mbrictson/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.2/ports/patches/libxml2/0010-Keep-non-significant-blanks-node-in-HTML-parser.patch:171: trailing whitespace.
<body bgcolor="#FFFFFF">
/Users/mbrictson/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.2/ports/patches/libxml2/0010-Keep-non-significant-blanks-node-in-HTML-parser.patch:172: trailing whitespace.
                <a href="mailto:katherine@cbfanc.org,website@bis.doc.gov?subject=South%20San%20Francisco%20BIS%20Seminar%20-%20October%2016th"></a><br>
/Users/mbrictson/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.2/ports/patches/libxml2/0010-Keep-non-significant-blanks-node-in-HTML-parser.patch:173: trailing whitespace.
</body>
/Users/mbrictson/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.2/ports/patches/libxml2/0010-Keep-non-significant-blanks-node-in-HTML-parser.patch:245: trailing whitespace.
<title>BP6.com #1 online resource for the BP6 Mobo....</title>
error: patch failed: result/HTML/attrents.html:1
error: result/HTML/attrents.html: patch does not apply
error: patch failed: result/HTML/doc3.htm:1
error: result/HTML/doc3.htm: patch does not apply
error: patch failed: result/HTML/test3.html:1
error: result/HTML/test3.html: patch does not apply
error: patch failed: result/HTML/wired.html:3
error: result/HTML/wired.html: patch does not apply
@knu
Copy link
Member

knu commented May 13, 2014

Hmm, this doesn't reproduce for me on OS X Mavericks or FreeBSD 10.

Maybe there is something wrong with patch(1)? (maybe too recent, too old, or broken somehow)
Try type patch (or which patch) / patch --version to start with.

@mattbrictson
Copy link
Author

$ which patch
/usr/bin/patch
$ patch --version
patch 2.5.8

I will test the installation on another Mavericks machine and see if I can reproduce.

@knu
Copy link
Member

knu commented May 13, 2014

On my MBP, looks like the same version of patch could successfully find the diff --git a/HTMLparser.c b/HTMLparser.c header and proceed.
I wonder what the difference is. LANG/LC_* perhaps?

@knu
Copy link
Member

knu commented May 13, 2014

I'll try gem install nokogiri -- --disable-clean and compare my successful case with yours later.

@knu
Copy link
Member

knu commented May 13, 2014

Un, no, tmp/ will be removed regardless of --disable-clean.
I'll have to try building nokogiri manually.

@mattbrictson
Copy link
Author

I asked another developer to test gem install nokogiri -v '1.6.2' on his Mavericks machine and he is getting the same error.

I tried manually running patch for the failing patch (0010-Keep-non-significant-blanks-node-in-HTML-parser.patch) and it applied fine. I'm stumped.

$ cd .rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.2/
$ patch -p1 -d ext/nokogiri/tmp/x86_64-apple-darwin13.1.0/ports/libxml2/2.8.0/libxml2-2.8.0 < ports/patches/libxml2/0010-Keep-non-significant-blanks-node-in-HTML-parser.patch
patching file HTMLparser.c
Hunk #1 succeeded at 2941 (offset -40 lines).
Hunk #2 succeeded at 2979 (offset -40 lines).
Hunk #3 succeeded at 5665 (offset -33 lines).
patching file result/HTML/53867.html
patching file result/HTML/Down.html
patching file result/HTML/attrents.html
patching file result/HTML/autoclose.html
patching file result/HTML/cf_128.html
patching file result/HTML/doc2.htm
patching file result/HTML/doc3.htm
patching file result/HTML/entities.html
patching file result/HTML/entities2.html
patching file result/HTML/fp40.htm
patching file result/HTML/html5_enc.html
patching file result/HTML/liclose.html
patching file result/HTML/lt.html
patching file result/HTML/noscript.html
patching file result/HTML/pre.html
patching file result/HTML/python.html
patching file result/HTML/reg1.html
patching file result/HTML/reg2.html
patching file result/HTML/reg3.html
patching file result/HTML/reg4.html
patching file result/HTML/repeat.html
patching file result/HTML/script.html
patching file result/HTML/script2.html
patching file result/HTML/test2.html
patching file result/HTML/test3.html
patching file result/HTML/utf8bug.html
patching file result/HTML/wired.html
patching file xmllint.c
Hunk #1 succeeded at 3339 (offset -1 lines).

@knu
Copy link
Member

knu commented May 13, 2014

OK, it wasn't patch(1) but git-apply(1) which is used by mini_portile to apply patches.

Mavericks should have 1.8.5.2 in /usr/bin with which the build succeeded for me:

% /usr/bin/git --version
git version 1.8.5.2 (Apple Git-48)

What's the version of git you are using?

@gsong
Copy link

gsong commented May 13, 2014

Homebrew's Git 1.9.2.

@mattbrictson
Copy link
Author

I use Homebrew's 1.9.3.

Just now I tried uninstalling it so that I am now using 1.8.5.2 (Apple Git-48). However, nokogiri still fails to install with the same error.

@sorah
Copy link
Contributor

sorah commented May 13, 2014

Succeeded using

(▰╹◡╹) git --version
git version 1.9.1
(▰╹◡╹) /usr/bin/git --version
git version 1.8.5.2 (Apple Git-48)
(▰╹◡╹) patch --version
patch 2.5.8
Copyright (C) 1988 Larry Wall
Copyright (C) 2002 Free Software Foundation, Inc.

This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

written by Larry Wall and Paul Eggert

@mattbrictson
Copy link
Author

Interesting! If I revert this commit in mini_portile (i.e. go back to using patch -p1 instead of git apply), then the nokogiri install succeeds.

flavorjones/mini_portile@4f4abd5

So somehow git apply is not working for me and @gsong.

@mattbrictson
Copy link
Author

Solved!

My ~/.gitconfig had the setting autocrlf = input. When I remove this setting the nokogiri build succeeds.

@sorah
Copy link
Contributor

sorah commented May 13, 2014

Thanks, it worked for my co-workers -- is this mini_portile's issue?

@sorah
Copy link
Contributor

sorah commented May 13, 2014

@mbrictson good work 👏

@knu
Copy link
Member

knu commented May 13, 2014

@mbrictson Good job! A tentative cure could be to prefix env GIT_CONFIG=/dev/null with a gem or bundle command line that triggers installation of the nokogiri gem. <- Doesn't work 😞

@martinb3
Copy link

Just to add to what @mbrictson said, nokogiri utlilizes mini_portile but doesn't explicitly depend on git being installed (mini_portile currently requires git). This also means that anything wrong with git will break the install (like various flavors of Ubuntu not coming with git installed at all).

@flavorjones
Copy link
Member

There are quite a few duplicates of this issue, so I'm closing this one. Please follow along for updates on this issue at #1102.

@emaildanwilson
Copy link

annoying... I just hit this too. appears that mini_portile doesn't check for it's patch dependency at all.

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

7 participants