raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: raindrops@librelist.org
Subject: Re: [PATCH] ...
Date: Wed, 6 Jun 2012 00:49:11 +0000
Message-ID: <20120606004911.GA31736@dcvr.yhbt.net> (raw)
In-Reply-To: <20120606001534.GA28607@dcvr.yhbt.net>

Eric Wong <normalperson@yhbt.net> wrote:
> Brian Corrigan <brian@genexp.me> wrote:
> > Hey Eric - can you take it for here?  Also, thanks for the patience :).
> > Fwiw, it's cool to have code in this project.  I learned a lot by reviewing
> > the source.
> 
> Sure thing.  Btw, don't top post and don't send HTML parts.  There's a
> lot of technical mailing lists that don't welcome these things.
> 
> Actually, did you get the test you added running at all?
> 
> File.symlink returns 0 on success, so using the return value is bogus.
> I'll rewrite it an squash a patch on top of it.

I'll squash the following on top of your changes.
However, I think the way unix_listener_stats behaves can pose
some confusing usability problems with symlinks

diff --git a/test/test_linux.rb b/test/test_linux.rb
index 81463c9..1da86cf 100644
--- a/test/test_linux.rb
+++ b/test/test_linux.rb
@@ -73,24 +73,24 @@ class TestLinux < Test::Unit::TestCase
     us = UNIXServer.new(tmp.path)
 
     # Create a symlink
-    destination = Tempfile.new("somethingelse")
-    destination.unlink # We need an available name, not an actual file
-    link = File.symlink(tmp, destination)
+    link = Tempfile.new("somethingelse")
+    File.unlink(link.path) # We need an available name, not an actual file
+    File.symlink(tmp.path, link.path)
 
     @to_close << UNIXSocket.new(tmp.path)
     stats = unix_listener_stats
-    assert_equal 0, stats[link.path].active
-    assert_equal 1, stats[link.path].queued
+    assert_equal 0, stats[tmp.path].active
+    assert_equal 1, stats[tmp.path].queued
 
-    @to_close << UNIXSocket.new(tmp.path)
+    @to_close << UNIXSocket.new(link.path)
     stats = unix_listener_stats
-    assert_equal 0, stats[link.path].active
-    assert_equal 2, stats[link.path].queued
+    assert_equal 0, stats[tmp.path].active
+    assert_equal 2, stats[tmp.path].queued
 
     @to_close << us.accept
     stats = unix_listener_stats
-    assert_equal 1, stats[link.path].active
-    assert_equal 1, stats[link.path].queued
+    assert_equal 1, stats[tmp.path].active
+    assert_equal 1, stats[tmp.path].queued
   end
 
   def test_tcp

-- 
Eric Wong


  reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-05 15:46 [PATCH] 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 Brian Corrigan
2012-06-05 17:57 ` [PATCH] Eric Wong
2012-06-05 23:59   ` [PATCH] Brian Corrigan
2012-06-06  0:15     ` [PATCH] Eric Wong
2012-06-06  0:49       ` Eric Wong [this message]
2012-06-06  0:50         ` [PATCH] Brian Corrigan
2012-06-06  0:56         ` [PATCH] unix_listener_stats follows and remembers symlinks Eric Wong

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/raindrops/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120606004911.GA31736@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=raindrops@librelist.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

raindrops RubyGem user+dev discussion/patches/pulls/bugs/help

Archives are clonable:
	git clone --mirror https://yhbt.net/raindrops-public
	git clone --mirror http://ou63pmih66umazou.onion/raindrops-public

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.raindrops

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git