about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-02-02 18:31:36 +0000
committerEric Wong <e@80x24.org>2016-02-23 18:48:15 +0000
commitb30fc2616c0428713e0b4b5426485fc2c3c0c7b7 (patch)
tree18112ad61b363e51ac77ab34d97b1093bbe5a809
parent606205cb7b3acb0d0c61cdd3dbf65b908f2534c0 (diff)
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
-rw-r--r--lib/raindrops/linux.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/raindrops/linux.rb b/lib/raindrops/linux.rb
index 7cfb653..a38fa64 100644
--- a/lib/raindrops/linux.rb
+++ b/lib/raindrops/linux.rb
@@ -47,6 +47,7 @@ module Raindrops::Linux
         if File.symlink?(path)
           link = path
           path = Pathname.new(link).realpath.to_s
+          path.force_encoding(Encoding::BINARY) if defined?(Encoding)
           rv[link] = rv[path] # vivify ListenerStats
         else
           rv[path] # vivify ListenerStats