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

Create temporary cache files in Dir.tmpdir #459

Conversation

olleolleolle
Copy link
Collaborator

@olleolleolle olleolleolle commented Dec 2, 2016

This PR is a compatibility bugfix for an issue on Windows.

See #458

Question: Does it work for you, @Arcanemagus? (Update: no, but that's another issue.)

Additional note: A directory such as C:\tmp must exist on the Windows machine for this to work right.

@olleolleolle olleolleolle changed the title Temporary cache files created in Dir.tmpdir Create temporary cache files in Dir.tmpdir Dec 2, 2016
@olleolleolle
Copy link
Collaborator Author

(There were linting problems due to changed rules, rebased against new master.)

@Arcanemagus
Copy link
Contributor

I'll see if I can build it locally to test.

@Arcanemagus
Copy link
Contributor

Seems to still be failing in the same place:

C:/Ruby23-x64/lib/ruby/2.3.0/logger.rb:711:in `initialize': No such file or directory @ rb_sysopen - /tmp/github-changelog-logger.log (Errno::ENOENT)
        from C:/Ruby23-x64/lib/ruby/2.3.0/logger.rb:711:in `open'
        from C:/Ruby23-x64/lib/ruby/2.3.0/logger.rb:711:in `create_logfile'
        from C:/Ruby23-x64/lib/ruby/2.3.0/logger.rb:705:in `rescue in open_logfile'
        from C:/Ruby23-x64/lib/ruby/2.3.0/logger.rb:702:in `open_logfile'
        from C:/Ruby23-x64/lib/ruby/2.3.0/logger.rb:695:in `set_dev'
        from C:/Ruby23-x64/lib/ruby/2.3.0/logger.rb:635:in `initialize'
        from C:/Ruby23-x64/lib/ruby/2.3.0/logger.rb:353:in `new'
        from C:/Ruby23-x64/lib/ruby/2.3.0/logger.rb:353:in `initialize'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator/octo_fetcher.rb:52:in `new'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator/octo_fetcher.rb:52:in `init_cache'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator/octo_fetcher.rb:36:in `initialize'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator/generator/generator.rb:24:in `new'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator/generator/generator.rb:24:in `initialize'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator.rb:28:in `new'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator.rb:28:in `initialize'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/bin/github_changelog_generator:5:in `new'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/bin/github_changelog_generator:5:in `<top (required)>'
        from C:/Ruby23-x64/bin/github_changelog_generator:22:in `load'
        from C:/Ruby23-x64/bin/github_changelog_generator:22:in `<main>'

Note that bundle exec rake checks does show a failure, but I'm not sure if it's related:

PS C:\Users\Landon Abney\Documents\GitHub\github-changelog-generator> bundle exec rake checks
Running RuboCop...
Inspecting 27 files
...........................

27 files inspected, no offenses detected
C:/Ruby23-x64/bin/ruby.exe -I'C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib';'C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rspec-support-3.5.0/lib' 'C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/exe/rspec' --pattern 'spec/**{,/*/**}/*_spec.rb'
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Randomized with seed 13708
.Error: wrong GitHub token                                              PR: 1/1
....................Can't detect user and name from first parameter: 'blah' -> exit'
..........................................................

Failures:

  1) GitHubChangelogGenerator::OctoFetcher#check_github_response when raises Octokit::Forbidden sleeps and retries and then aborts
     Failure/Error: Helper.log.warn @client.rate_limit

     Faraday::SSLError:
       SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
     # ./lib/github_changelog_generator/octo_fetcher.rb:332:in `block in retry_callback'
     # ./lib/github_changelog_generator/octo_fetcher.rb:297:in `check_github_response'
     # ./spec/unit/octo_fetcher_spec.rb:35:in `block (4 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # Octokit::Forbidden:
     #   Octokit::Forbidden
     #   ./spec/unit/octo_fetcher_spec.rb:35:in `block (5 levels) in <top (required)>'

Finished in 11.58 seconds (files took 4.14 seconds to load)
137 examples, 1 failure

Failed examples:

rspec ./spec/unit/octo_fetcher_spec.rb:30 # GitHubChangelogGenerator::OctoFetcher#check_github_response when raises Octokit::Forbidden sleeps and retries and then aborts

Randomized with seed 13708

[Coveralls] Outside the CI environment, not sending data.
Coverage report generated for RSpec to C:/Users/Landon Abney/Documents/GitHub/github-changelog-generator/coverage. 927 / 1352 LOC (68.57%) covered.
C:/Ruby23-x64/bin/ruby.exe -I'C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib';'C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rspec-support-3.5.0/lib' 'C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/exe/rspec' --pattern 'spec/**{,/*/**}/*_spec.rb' failed

Something seems to be up though, since if I manually put the proper temp path in there it still gives that same path, trying to trace down whether options is screwing it up.

@Arcanemagus
Copy link
Contributor

Okay, the options object coming into the OctoFetcher.initialize is where the improper path is coming from, tracing down where that is getting the wrong value.

My .github_changelog_generator files are all variants of this, so it's not from them:

unreleased=true
future-release=v0.12.0
exclude_labels=duplicate,question,invalid,wontfix,Duplicate,Question,Invalid,Wontfix,External

@olleolleolle
Copy link
Collaborator Author

@Arcanemagus
Copy link
Contributor

I literally just found that and looked over here to post that only to see your comment appear 😛!

@olleolleolle
Copy link
Collaborator Author

olleolleolle commented Dec 5, 2016

@Arcanemagus If you change those to the starting value nil, what does our program do then?

        cache_file: nil,
        cache_log: nil

@Arcanemagus
Copy link
Contributor

I hit the following then:

C:/Ruby23-x64/lib/ruby/2.3.0/net/http.rb:933:in `connect_nonblock': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (Faraday::SSLError)
        from C:/Ruby23-x64/lib/ruby/2.3.0/net/http.rb:933:in `connect'
        from C:/Ruby23-x64/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
        from C:/Ruby23-x64/lib/ruby/2.3.0/net/http.rb:852:in `start'
        from C:/Ruby23-x64/lib/ruby/2.3.0/net/http.rb:1398:in `request'
        from C:/Ruby23-x64/lib/ruby/2.3.0/net/http.rb:1156:in `get'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/faraday-0.10.0/lib/faraday/adapter/net_http.rb:81:in `perform_request'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/faraday-0.10.0/lib/faraday/adapter/net_http.rb:41:in `block in call'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/faraday-0.10.0/lib/faraday/adapter/net_http.rb:88:in `with_net_http_connection'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/faraday-0.10.0/lib/faraday/adapter/net_http.rb:33:in `call'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/faraday-0.10.0/lib/faraday/response.rb:8:in `call'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/faraday-http-cache-2.0.0/lib/faraday/http_cache.rb:290:in `fetch'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/faraday-http-cache-2.0.0/lib/faraday/http_cache.rb:195:in `process'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/faraday-http-cache-2.0.0/lib/faraday/http_cache.rb:142:in `call!'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/faraday-http-cache-2.0.0/lib/faraday/http_cache.rb:115:in `call'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/faraday-0.10.0/lib/faraday/rack_builder.rb:139:in `build_response'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/faraday-0.10.0/lib/faraday/connection.rb:377:in `run_request'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/faraday-0.10.0/lib/faraday/connection.rb:140:in `get'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/sawyer-0.8.1/lib/sawyer/agent.rb:94:in `call'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/octokit-4.6.2/lib/octokit/connection.rb:154:in `request'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/octokit-4.6.2/lib/octokit/connection.rb:84:in `paginate'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/octokit-4.6.2/lib/octokit/client/repositories.rb:465:in `tags'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator/octo_fetcher.rb:79:in `block in calculate_pages'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator/octo_fetcher.rb:298:in `block in check_github_response'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/retriable-2.1.0/lib/retriable.rb:54:in `block in retriable'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/retriable-2.1.0/lib/retriable.rb:48:in `times'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/retriable-2.1.0/lib/retriable.rb:48:in `retriable'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator/octo_fetcher.rb:297:in `check_github_response'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator/octo_fetcher.rb:78:in `calculate_pages'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator/octo_fetcher.rb:97:in `github_fetch_tags'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator/octo_fetcher.rb:70:in `block in get_all_tags'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator/octo_fetcher.rb:298:in `block in check_github_response'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/retriable-2.1.0/lib/retriable.rb:54:in `block in retriable'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/retriable-2.1.0/lib/retriable.rb:48:in `times'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/retriable-2.1.0/lib/retriable.rb:48:in `retriable'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator/octo_fetcher.rb:297:in `check_github_response'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator/octo_fetcher.rb:70:in `get_all_tags'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator/generator/generator_tags.rb:9:in `fetch_and_filter_tags'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator/generator/generator_generation.rb:8:in `compound_changelog'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/lib/github_changelog_generator.rb:34:in `run'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/github_changelog_generator-1.14.2/bin/github_changelog_generator:5:in `<top (required)>'
        from C:/Ruby23-x64/bin/github_changelog_generator:22:in `load'
        from C:/Ruby23-x64/bin/github_changelog_generator:22:in `<main>'

This does look related to the spec failure, want a new issue filed for that?

@olleolleolle
Copy link
Collaborator Author

olleolleolle commented Dec 5, 2016

@Arcanemagus No, this is not an issue with the program, my guess is it's that's a SSL certificates issue, related to your machine not having certificate authorities' certificate bundles available to it.

Here's a long article about it: http://mislav.net/2013/07/ruby-openssl/

@Arcanemagus
Copy link
Contributor

I understand that it's an SSL error, my point (as a user) is that v1.13.2 works, and v1.14.0 (and up) doesn't due to that.

From what I've been finding around on the web the "solution" seems to all point to variants of http://stackoverflow.com/a/16134586/631338 which is a bit silly to expect all your users to have to go through.

@Arcanemagus
Copy link
Contributor

lostisland/faraday#392 (comment) is exactly my point, this is on github_changelog_generator to ensure it has a working certificate store (since apparently Ruby can't use the system one?!?).

I'm assuming that's why github_api and several other gems are bundling the cacert.pem file with their project.

@olleolleolle
Copy link
Collaborator Author

I'm not saying you're wrong.

Commits like this:
piotrmurach/github@926cd06

...they put a lot of responsibility in the hands of the individual project: when a cert is un-trusted for some reason, the project's got to update their cert bundle. Example:
http://superuser.com/questions/605900/why-wont-os-x-trust-githubs-ssl-certificate

I'll mull on this.

@olleolleolle
Copy link
Collaborator Author

@Arcanemagus In order to solve one thing at a time, can we open a new Windows-labeled issue for the cacert.pem SSL cert idea?

@olleolleolle olleolleolle merged commit 8d74965 into github-changelog-generator:master Feb 8, 2017
@olleolleolle olleolleolle deleted the fix/issue-with-tmp-dir branch February 8, 2017 17:14
@olleolleolle
Copy link
Collaborator Author

@Arcanemagus In order for the Issue to be owned by you, can you open it, and make links and such? (I don't run Windows.)

@Arcanemagus
Copy link
Contributor

Already writing it 😉.

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

Successfully merging this pull request may close these issues.

None yet

2 participants