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
|
|
Newer rubies have more warnings
|
|
The File.readlink has been available since the earliest SVN import
of Ruby from Jan 16 1998. There's no reason to load the Pathname
class here since we don't do any further pathname manipulation.
So avoid loading the extra .so here and creating extra objects.
|
|
File.readlink (and thus Pathname#realpath) returns the filesystem
encoding (Encoding.find "filesystem"). The filesystem encoding
defaults to the locale encoding, which tends to be UTF-8. This
is true even on *nix filesystems which can have any byte besides
"\0".
ref: https://bugs.ruby-lang.org/issues/12034
ref: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/73593
|
|
When unix_listener_stats is called without arguments, it should
still match the behavior of tcp_listener_stats and return
ListenerStats object with zero values.
This allows callers to iterate through the results to find the
pathnames of all the Unix domain sockets in in listen mode.
|
|
Teach unix_listener_stats to remember the symlink path
it followed and have it point to the same object as the
resolved (real) socket path.
This allows the case where looking up stats by symlinks
works if the symlink is given to unix_listener_stats:
File.symlink("/real/path/of.sock", "/path/to/link.sock")
stats = unix_listener_stats(["/path/to/link.sock"])
stats["/path/to/link.sock"] => # same as stats["/real/path/of.sock"]
|
|
Raindrops currently fails when provided a symlink to a socket.
As this is a common practice for many deployment tools (Vlad,
etc.) this patch adds support for finding the realpath prior to
looking the socket up in /proc/net/unix
[ew: commit message subject]
[ew: fixed test to pass under 1.9.3 and 1.8.7:
* Tempfile#unlink is unsafe to call if we want to reuse the
path, use File.unlink(tmp.path) instead
* The return value of File.symlink is zero (or it raises),
so it's unusable.
* File.symlink will not call #to_path under 1.8.7, so it's
necessary to pass pathnames to it, not Tempfile objects.
]
Signed-off-by: Eric Wong <normalperson@yhbt.net>
|
|
Signed-off-by: Aman Gupta <aman@tmm1.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
|
|
More confusing for me, actually...
|
|
This matches behavior of the TCP version.
|
|
Yes we love Linux more than other systems :>
|
|
Of course, RDoc doesn't know quantity vs quality :)
|
|
People actually need to load modules manually on older kernels :<
|
|
No need to clutter/confuse namespace lookups
|
|
File.read under 1.9 takes an :encoding argument to force binary
encoding for its return value.
|
|
|