We were trying to remove directories using `FileUtils.rm_f` which is
unexpected and does not remove anything. Changing to `FileUtils.rm_rf`
actually removes the directories properly. That itself showed other
issues:
* One test was actually removing the gem package it was about to
install, since it was living in the cache folder. To fix that, avoid
removing the cache folder, and only make sure the other directories
are created automatically, which seems enough.
* Another test was actually removing an incorrect directory. Change it
to remove the right one (the one that's asserted later to have been
created).
https://github.com/rubygems/rubygems/commit/5538e7ff20
Maybe not the best idea for CI stability to use development versions of
Clang, but that does give us a preview of what's coming and gives us a
chance to make suggestions upstream.
The last parameter of `ccan_list_top()` is to acquire the pointer
of the top of element, so `node.ubf` is no problem. But this context
it accesses gvl list, so `node.gvl` is better.
Previously, the content-encoding header was removed and the body
was modified, but the content-length header was not modified,
resulting in the content-length header not matching the body
length.
Don't delete content-length before yielding inflate body, as that
causes a switch to read the entire body instead of reading in
chunks.
Fixes [Bug #16672]
https://github.com/ruby/net-http/commit/58284e9710
Co-authored-by: st0012 <stan001212@gmail.com>
Allocating a string of length MAXPATHLEN and then shrinking the string
is inefficient when the resulting path is short. Preallocating a large
string is also a problem for Variable Width Allocation since we can't
easily downsize the capacity.
I ran the following benchmark:
```ruby
Benchmark.ips do |x|
{
"empty" => "",
"short" => "a/" * 10,
"medium" => "a/" * 100,
"long" => "a/" * 500
}.each do |name, path|
x.report(name) do |times|
i = 0
while i < times
File.expand_path(path)
i += 1
end
end
end
end
```
On this commit:
```
empty 97.486k (± 0.7%) i/s - 492.915k in 5.056507s
short 96.026k (± 2.4%) i/s - 486.489k in 5.068966s
medium 86.304k (± 1.3%) i/s - 435.336k in 5.045112s
long 59.395k (± 1.7%) i/s - 302.175k in 5.089026s
```
On master:
```
empty 94.138k (± 1.4%) i/s - 472.158k in 5.016590s
short 92.043k (± 1.4%) i/s - 468.180k in 5.087496s
medium 84.910k (± 2.3%) i/s - 425.750k in 5.017007s
long 61.503k (± 2.7%) i/s - 309.723k in 5.039429s
```