Commit graph

14659 commits

Author SHA1 Message Date
ima1zumi
ca33b59099 [ruby/reline] fix TerminfoError -> Reline::Terminfo::TerminfoError
c07b0ace6a
2021-12-02 23:41:44 +09:00
ima1zumi
697d7b8d62 [ruby/reline] Rescue if tigetstr(capname) cannot be obtained
fix https://github.com/ruby/reline/issues/384

If `$TERM` is `vt102`, there are no `kend`, `khome`, `civis`, or `cnorm` in capabilities.
`TerminfoError` is raised in `Reline::Terminfo.tigetstr(capname)`, so it is rescued if it does not exist.

c9f5112702
2021-12-02 23:41:43 +09:00
David Rodríguez
39f2b4f1a4 [rubygems/rubygems] This warrants a comment
8fa29e5e55
2021-12-02 18:10:32 +09:00
David Rodríguez
cf88271331 [rubygems/rubygems] Fix gemspec source unlocking also for prereleases like 0.0.0.SNAPSHOT
The default prerelease requirement in rubygems doesn't actually match
things like "0.0.0.SNAPSHOT".

711498b342
2021-12-02 18:10:31 +09:00
David Rodríguez
2a15b28a9e [rubygems/rubygems] Fix materialization of locked 0 prereleases
Since the default requirement in rubygems is ">= 0", it was failing to
match 0 prereleases. Changing the default globally to be ">= 0.a"
instead is a major refactoring that's quite tricky to make backwards
compatible, so I'm special casing this where needed for now to fix the
regression.

68fe37937c
2021-12-02 18:10:31 +09:00
schneems
2b22c93533 Compatibility with IRB
Instead of accessing the struct as an array, access it via methods. There are other places inside of this file already using this API (for example e0a5c3d2b7/lib/irb/ruby-lex.rb (L829-L830)).

This commit moves all struct array-ish calls to use their method calls instead. It is also ~1.23 faster accessing values via a method instead of as an array according to this microbenchmark:

```ruby
Elem = Struct.new(:pos, :event, :tok, :state, :message) do
  def initialize(pos, event, tok, state, message = nil)
    super(pos, event, tok, State.new(state), message)
  end

  # ...

  def to_a
    a = super
    a.pop unless a.empty?
    a
  end
end

class ElemClass
  attr_accessor :pos, :event, :tok, :state, :message

  def initialize(pos, event, tok, state, message = nil)
    @pos = pos
    @event = event
    @tok = tok
    @state = State.new(state)
    @message = message
  end

  def to_a
    if @message
      [@pos, @event, @tok, @state, @message]
    else
      [@pos, @event, @tok, @state]
    end
  end
end

# stub state class creation for now
class State; def initialize(val); end; end
```

```ruby
Benchmark.ips do |x|
  x.report("struct") { struct[1] }
  x.report("class ") { from_class.event }
  x.compare!
end; nil
```

```
Warming up --------------------------------------
              struct     1.624M i/100ms
              class      1.958M i/100ms
Calculating -------------------------------------
              struct     17.139M (± 2.6%) i/s -     86.077M in   5.025801s
              class      21.104M (± 3.4%) i/s -    105.709M in   5.015193s

Comparison:
              class : 21103826.3 i/s
              struct: 17139201.5 i/s - 1.23x  (± 0.00) slower
```
2021-12-02 15:55:42 +09:00
Hiroshi SHIBATA
e387458da9
Ignore to generate the documentation from vendored libraries 2021-12-02 08:50:03 +09:00
Vít Ondruch
94ee88b38c [rubygems/rubygems] Provide distinguished name which will be correctly parsed.
It seems that since ruby openssl 2.1.0 [[1]], the distinguished name
submitted to `OpenSSL::X509::Name.parse` is not correctly parsed if it
does not contain the first slash:

~~~
$ ruby -v
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]

$ gem list | grep openssl
openssl (default: 2.2.0)

$ irb -r openssl
irb(main):001:0> OpenSSL::X509::Name.parse("CN=nobody/DC=example").to_s(OpenSSL::X509::Name::ONELINE)
=> "CN = nobody/DC=example"
irb(main):002:0> OpenSSL::X509::Name.parse("/CN=nobody/DC=example").to_s(OpenSSL::X509::Name::ONELINE)
=> "CN = nobody, DC = example"
~~~

Instead, use `OpenSSL::X509::Name.new` directly as suggested by upstream
maintainer.

[1]: 19c67cd10c

09ca0c2dae

Co-authored-by: Kazuki Yamaguchi <k@rhe.jp>
2021-12-02 04:43:06 +09:00
Hiroshi SHIBATA
0b53a8895f
Merge rubygems master fd676ac464491afaa0baf5435cb11b3f86229cbd 2021-12-01 11:00:10 +09:00
Olle Jonsson
b68217fff9 [rubygems/rubygems] Update bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt
8836fe157b

Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
2021-12-01 07:15:18 +09:00
Olle Jonsson
46a24f7e77 [rubygems/rubygems] Update main.yml.tt
3260173c59
2021-12-01 07:15:18 +09:00
Olle Jonsson
a7fd639423 [rubygems/rubygems] newgem tmpl: ruby as "2.7" in GH Actions matrix
f5bead5634
2021-12-01 07:15:17 +09:00
Olle Jonsson
42efb8c185 [rubygems/rubygems] newgem templ: Avoid Float 3.0 -> "3" in GH Action
This change avoids a YAML Float-to-String conversion, which turns a 3.0 into a "3". That can make names of builds less clear.

In order to use this new capability, I added a "name" descriptor to the matrix-created Job.

6221241ad4
2021-12-01 07:15:17 +09:00
David Rodríguez
7fd88da935 [rubygems/rubygems] Fix race condition when reading & writing gemspecs concurrently
When bundler parallel installer installs gems concurrently, one can get
confusing warnings like the following:

```
"[/home/runner/work/rubygems/rubygems/bundler/tmp/2/gems/system/specifications/zeitwerk-2.4.2.gemspec] isn't a Gem::Specification (NilClass instead).
```

I've got these warnings several times in the past, but I never managed
to reproduce them, and never look deeply into the root cause, but this
time a got a cause that reproduced quite frequently, so I looked into
it.

The problem is one thread reading a gemspec while another thread is
writing it. The write of the gemspec was not protected, so
`Gem::Specification.load` could end up seeing a truncated gemspec and
thus throw this warning.

The fix involve two changes:

* Change the methods that write gemspecs to use `Gem.binary_write` which
  is protected by a lock.

* Fix `Gem.binary_write` to create the file lock at file creation time,
  not when the file already exists after.

The realworld user problem caused by this issue happens in bundler, but
I'm fixing it in rubygems first, and then I'll backport to bundler
whatever needs backporting to fix the issue on the bundler side.

a672e7555c
2021-11-30 20:54:05 +09:00
David Rodríguez
d7f6cb0f78 [rubygems/rubygems] Revert "Remove spec file before building"
This reverts commit af604436d8141c34cb2e1e645b9b0d47bfd55a55.

The issue that led to introducing it was never reproduced. I tried to
repro with this patch and it still works just fine. Since this removal
is getting in the middle for some race conditions I'm facing, I'm
reverting the patch.

2dd267f0e4
2021-11-30 20:54:05 +09:00
Yusuke Endoh
dc46529b64 [ruby/error_highlight] Ignore all syscall errors
At least, Error::ENOTSUP may be raised on some extreme environments

2787983ff7
2021-11-30 13:49:04 +09:00
Yusuke Endoh
3288f0d09e lib/pp.rb (width_for): Ignore all syscall errors
According to nobu, Errno::EBAD is raised on Windows.
2021-11-30 13:46:08 +09:00
Yusuke Endoh
20065eabdb lib/pp.rb (width_for): ignore Errno::EINVAL
The error is raised on Solaris
20211130T030003Z.fail.html.gz
```
  1) Failure:
TestRubyOptions#test_require [/export/home/users/chkbuild/cb-gcc/tmp/build/20211130T030003Z/ruby/test/ruby/test_rubyoptions.rb:265]:
pid 7386 exit 1
| /export/home/users/chkbuild/cb-gcc/tmp/build/20211130T030003Z/ruby/lib/pp.rb:67:in `winsize': Invalid argument - <STDOUT> (Errno::EINVAL)
```
2021-11-30 13:17:54 +09:00
Yusuke Endoh
eac347fdb0 lib/pp.rb (PP.pp): Use io/console's winsize by default
[Feature #12913]
2021-11-30 11:43:54 +09:00
ooooooo-q
af59d35570 [rubygems/rubygems] Fix escape of filenames in bundle doctor
3ede1435ea
2021-11-30 01:29:34 +09:00
Nobuyoshi Nakada
659c864a43 [rubygems/rubygems] Deprecate typo name
62d54cbf08
2021-11-29 23:38:01 +09:00
Nobuyoshi Nakada
e19b656409 [ruby/readline] Suppress constant redefinition warning
When already set by `use_lib_reline` in test/readline/helper.rb of
readline-ext.

0e3ca3b217
2021-11-29 18:50:27 +09:00
Nobuyoshi Nakada
ca7de49aa5 [ruby/ostruct] [DOC] Fix code markups [ci skip]
Backquotes are not special characters in RDoc.

a901df26b9
2021-11-28 17:10:48 +09:00
Nobuyoshi Nakada
f53f6d9284
[ruby/cgi] Exclude unused files from built package
e840b6c368
2021-11-27 18:40:03 +09:00
Nobuyoshi Nakada
45034e9de3 [ruby/cgi] Set extconf.rb to extensions
Fix https://github.com/ruby/cgi/pull/11

60d8f5e7d9
2021-11-27 14:44:46 +09:00
David Rodríguez
59439446d9 [rubygems/rubygems] Fix missing locked specs when depended on other platform
0396e899db
2021-11-27 05:31:54 +09:00
Nobuyoshi Nakada
dff8d12226 mkmf: take PKG_CONFIG_PATH from dir_config library path
So that version dependent pkg-config files can override files in
the default locations.
2021-11-26 22:32:26 +09:00
Nobuyoshi Nakada
21a29844a3 mkmf: deal with environment variables in MakeMakefile#xpopen 2021-11-26 22:32:26 +09:00
Nobuyoshi Nakada
1c3d6d6cc9 mkmf: MakeMakefile#xpopen may be passed an option hash 2021-11-26 22:32:26 +09:00
David Rodríguez
f3320f164f [rubygems/rubygems] Fix bundle info sometimes claiming that bundler has been deleted
fe1a31db31
2021-11-26 08:50:52 +09:00
David Rodríguez
c4b1aa19a3 [rubygems/rubygems] Don't replace ENV twice on non Windows platforms
8dc86b7096
2021-11-25 04:02:19 +09:00
Yusuke Endoh
5445d33be2 [ruby/cgi] Bump version
c9c800715e
2021-11-24 19:59:00 +09:00
Nobuyoshi Nakada
0f31b3f465 [ruby/cgi] When parsing cookies, only decode the values
052eb3a828
2021-11-24 19:59:00 +09:00
David Rodríguez
997adfd410 [rubygems/rubygems] Clarify bundle viz deprecation
7f22fe56b3
2021-11-22 09:29:13 +09:00
ima1zumi
f5829e2935 [ruby/reline] Correct padding space calculation
fix https://github.com/ruby/irb/issues/308

This bug occurred when `dialog.width - calculate_width(s, true)` was negative.

When `dialog.width` is shorter than `old_dialog.width`, it calculates how much padding it has to do. However, there are cases where `s` is longer than `dialog.width`, as in the issue. In that case, `padding_space_with_escape_sequences` will crash.

Here, `old_dialog.width` is longer than `dialog.width`, so I changed the padding width to `old_dialog.width - dialog.width`.

c581c31e0f
2021-11-21 13:56:26 +09:00
Nobuyoshi Nakada
aa591af296
Do not document vendored files [ci skip]
Just duplications.
2021-11-19 21:55:27 +09:00
David Rodríguez
39c4673e3c [rubygems/rubygems] Previous logic can mostly go now
3241b34055
2021-11-19 10:12:11 +09:00
David Rodríguez
80f39d78df [rubygems/rubygems] Allow bundle update to downgrade gems by changing the Gemfile
6a19cca7e5
2021-11-19 10:12:10 +09:00
David Rodríguez
55f574136c [rubygems/rubygems] Extract a converge_specs method for later reusing it
e896e63ac3
2021-11-19 10:12:09 +09:00
David Rodríguez
2730e45f45 [rubygems/rubygems] Avoid unnecessary loop
afaf868b68
2021-11-19 10:12:09 +09:00
David Rodríguez
8bdb56fcaf [rubygems/rubygems] Protect specs access at a finer level
c8cc053bde
2021-11-18 04:37:28 +09:00
David Rodríguez
4bc69a25f3 [rubygems/rubygems] Stop using a constant for something not constant
5cb0b9d9b8
2021-11-18 04:37:27 +09:00
David Rodríguez
a5cd4a0568 [rubygems/rubygems] Extract a helper method to reset specs
662de0c990
2021-11-18 04:37:27 +09:00
David Rodríguez
f542ab2e6d [rubygems/rubygems] Make clearing loaded spec cache really private
19f117652b
2021-11-18 04:37:26 +09:00
David Rodríguez
81eba77fc0 [rubygems/rubygems] We can now use standard memoization
231be44d38
2021-11-18 04:37:25 +09:00
David Rodríguez
61f023f03b [rubygems/rubygems] Easier preservation of activated specs
54e923ffc2
2021-11-18 04:37:25 +09:00
David Rodríguez
fdd3eed037 [rubygems/rubygems] Set @@all variable at class definition time
To spare the `defined?` check.

64d27bba01
2021-11-18 04:37:24 +09:00
Olle Jonsson
c240ccd643 [ruby/net-http] gemspec: Drop unused directive "executables"
This gem exposes no executable files.

3b3743f6ce
2021-11-17 19:09:14 +09:00
Akinori MUSHA
ed7a641378
[ruby/ipaddr] Bump version to 1.2.3
37007e7812
2021-11-16 21:04:46 +09:00
Nobuyoshi Nakada
5bff4cd56c [ruby/net-protocol] Update the required ruby version
d4982420e6
2021-11-16 20:56:04 +09:00