raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [RFC] linux: workaround Ruby 2.3 change
@ 2016-02-02 18:31 Eric Wong
  2016-02-23  2:04 ` [RFC 2/1] linux: remove Pathname stdlib dependency Eric Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Wong @ 2016-02-02 18:31 UTC (permalink / raw)
  To: raindrops-public

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
---
 lib/raindrops/linux.rb | 1 +
 1 file changed, 1 insertion(+)

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
-- 
EW


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-23 11:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-02 18:31 [RFC] linux: workaround Ruby 2.3 change Eric Wong
2016-02-23  2:04 ` [RFC 2/1] linux: remove Pathname stdlib dependency Eric Wong
2016-02-23 11:00   ` Antonio Terceiro

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/raindrops.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).