Date | Commit message (Collapse) |
|
Once again Ruby seems ready to introduce more incompatibilities
and force busywork upon maintainers[1]. In order to avoid
incompatibilities in the future, I used the following Perl
script to prepend `frozen_string_literal: false' to every
Ruby file:
use v5.12;
use autodie;
my $usage = 'perl /path/to/script <LIST_OF_RB_FILES>';
my $fsl = "# frozen_string_literal: false\n";
for my $f (@ARGV) {
open my $fh, '<', $f;
my $s = do { local $/; <$fh> } // die "read($f): $!";
next if $s =~ /^#\s*frozen_string_literal:/sm;
# fsl must be after encoding: line if it exists:
if ($s =~ s/^([ \t]*\#[ \t\-\*\#]+encoding:[^\n]+\n)/$1$fsl/sm
# or after the shebang
|| $s =~ s/^(#![^\n]+\n)/$1$fsl/
# or after embedded switches in rackup files:
|| ($f =~ /\.ru$/ &&
$s =~ s/^(#\\[^\n]+\n)/$1$fsl/)
# or prepend as a last resort:
|| (substr($s, 0, 0) = $fsl)) {
open $fh, '>', $f;
print $fh $s;
close $fh;
}
}
Somebody interested will have to go through every Ruby source
file and enable frozen_string_literal once they've thoroughly
verified it's safe to do so.
[1] https://bugs.ruby-lang.org/issues/20205
|
|
Eric Wong <bofh@yhbt.net> wrote:
> I'll squash this in for fork+preload safety.
I forget there are multithreaded servers using this :x
------8<-----
Subject: [PATCH v3] middleware: reuse inet_diag netlink socket
No point in constantly allocating and deallocating FDs (and Ruby
IO objects) when reusing them is supported.
However, we must guard it against parallel callers since
linux_inet_diag.c::diag releases the GVL while calling
sendmsg(2) and recvmsg(2), so it's possible two Ruby threads can
end up crossing streams if the middlware is used with a
multi-threaded server.
AFAIK, Raindrops::Middleware isn't a heavily-trafficked endpoint,
so saving FDs and avoiding thread specific data is preferable
for memory-constrained systems I use.
|
|
The expiration for bogomips.org is coming up and I'm not
keen on paying or supporting extortionists.
Not wanting to be beholden to ICANN or any powerful
organizations, .onion sites are available to Tor users:
http://raindrops.ou63pmih66umazou.onion/
http://ou63pmih66umazou.onion/raindrops.git/
http://ou63pmih66umazou.onion/raindrops-public/
(the demo is not yet available via .onion, yet, could be a bit)
|
|
While raindrops.bogomips.org exists, having extra subjectAltName
entries is bloating the certificate. This will make it easier
to mirror the homepage on Tor hidden services.
|
|
The "defineclass" VM instruction takes more operands
and uses more space than "setconstant". Since we have no
methods or subclasses/constants to define under the
"Raindrops::Middleware::Stats" class,
|
|
Since Ruby 2.2, frozen string literals are implied for Hash#[]
lookups. Constant lookups have inline caching since Ruby 1.9
(from YARV).
|
|
Signed-off-by: Aman Gupta <aman@tmm1.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
|
|
|
|
Of course, RDoc doesn't know quantity vs quality :)
|
|
Seems to basically work
|
|
It's easier to find this way.
|
|
Oops!
|
|
We need to do this for apps that depend on things like the
sendfile() optimizations in Rainbows!
|
|
Since Unicorn and Rainbows! support IPv6 now, it makes sense to
support the rfc2732-style addresses it returns.
|
|
These are slightly faster than regular method dispatch
|
|
It's a needless allocation
|
|
No need to clutter/confuse namespace lookups
|
|
|
|
If stats.decr_writing never fails, really (or something is
seriously wrong (like memory corruption) and the ensure block
wouldn't fire anyways).
|
|
This allows easier configuration when used with Unicorn and
derived servers (Rainbows! and Zbatery).
|
|
|