kgio RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [ANN] kgio 2.8.1 - minor improvements and test fixes
@ 2013-09-11  0:29  4% Eric Wong
  0 siblings, 0 replies; 4+ results
From: Eric Wong @ 2013-09-11  0:29 UTC (permalink / raw)
  To: kgio

Changes:

Improved error reporting for kgio_accept/kgio_tryaccept.
Minor size reduction throughout.  There are also several
test case fixes for race conditions.

Thanks to Hleb Valoshka and the Debian project for all the
help with this release!

Eric Wong (7):
      check syscall returns against < 0 instead of == -1
      accept: more informative exception on unknown family
      test_tryopen: skip EACCES test when euid == 0
      test/lib_read_write: account for larger-than-normal pipes
      test_poll: avoid potentially thread-unsafe test
      test_poll: preserve original trap(:USR1) handler
      test_poll: be less dependent on signal handler ordering

Hleb Valoshka (4):
      Change prefix of temporary sockets to prevent races
      Don't dump 20M in case of failure
      Create own directory for every unix socket in unit tests
      Close tempfile and unlink it immediately.

* http://bogomips.org/kgio/
* kgio@librelist.org
* git://bogomips.org/kgio.git
* http://bogomips.org/kgio/NEWS.atom.xml


^ permalink raw reply	[relevance 4%]

* Re: [PATCH] Close tempfile and unlink it immediately.
  2013-09-07 20:21  7% ` Eric Wong
@ 2013-09-07 22:51  7%   ` Aeon
  0 siblings, 0 replies; 4+ results
From: Aeon @ 2013-09-07 22:51 UTC (permalink / raw)
  To: kgio

Unsubscribe

On Saturday, September 7, 2013, Eric Wong wrote:

> Hleb Valoshka <375gnu@gmail.com <javascript:;>> wrote:
> > When a Tempfile object is garbage collected, or when the Ruby interpreter
> > exits, its associated temporary file is automatically deleted. This may
> > lead to race condition when Tempfile is used like in these tests.
>
> Thanks!  Signed-off and pushed to git://bogomips.org/kgio.git as
> commit c3be428c452fd9c91d31b5b7d5b697175b6652df
>


^ permalink raw reply	[relevance 7%]

* Re: [PATCH] Close tempfile and unlink it immediately.
  2013-09-07 20:07  5% [PATCH] Close tempfile and unlink it immediately Hleb Valoshka
@ 2013-09-07 20:21  7% ` Eric Wong
  2013-09-07 22:51  7%   ` Aeon
  0 siblings, 1 reply; 4+ results
From: Eric Wong @ 2013-09-07 20:21 UTC (permalink / raw)
  To: kgio

Hleb Valoshka <375gnu@gmail.com> wrote:
> When a Tempfile object is garbage collected, or when the Ruby interpreter
> exits, its associated temporary file is automatically deleted. This may
> lead to race condition when Tempfile is used like in these tests.

Thanks!  Signed-off and pushed to git://bogomips.org/kgio.git as
commit c3be428c452fd9c91d31b5b7d5b697175b6652df


^ permalink raw reply	[relevance 7%]

* [PATCH] Close tempfile and unlink it immediately.
@ 2013-09-07 20:07  5% Hleb Valoshka
  2013-09-07 20:21  7% ` Eric Wong
  0 siblings, 1 reply; 4+ results
From: Hleb Valoshka @ 2013-09-07 20:07 UTC (permalink / raw)
  To: kgio

When a Tempfile object is garbage collected, or when the Ruby interpreter
exits, its associated temporary file is automatically deleted. This may
lead to race condition when Tempfile is used like in these tests.
---
 test/test_autopush.rb                      | 3 +--
 test/test_unix_client_read_server_write.rb | 3 +--
 test/test_unix_connect.rb                  | 3 +--
 test/test_unix_server.rb                   | 3 +--
 test/test_unix_server_read_client_write.rb | 3 +--
 5 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/test/test_autopush.rb b/test/test_autopush.rb
index 6c6e05f..38b7c52 100644
--- a/test/test_autopush.rb
+++ b/test/test_autopush.rb
@@ -44,8 +44,7 @@ class TestAutopush < Test::Unit::TestCase
     Kgio.autopush = true
     tmp = Tempfile.new('kgio_unix')
     @path = tmp.path
-    File.unlink(@path)
-    tmp.close rescue nil
+    tmp.close!
     @srv = Kgio::UNIXServer.new(@path)
     @rd = Kgio::UNIXSocket.new(@path)
     t0 = nil
diff --git a/test/test_unix_client_read_server_write.rb b/test/test_unix_client_read_server_write.rb
index 2f2b7b9..c8835cd 100644
--- a/test/test_unix_client_read_server_write.rb
+++ b/test/test_unix_client_read_server_write.rb
@@ -7,8 +7,7 @@ class TestUnixClientReadServerWrite < Test::Unit::TestCase
     @tmpdir = Dir.mktmpdir('kgio_unix_0')
     tmp = Tempfile.new('kgio_unix_0', @tmpdir)
     @path = tmp.path
-    File.unlink(@path)
-    tmp.close rescue nil
+    tmp.close!
     @srv = Kgio::UNIXServer.new(@path)
     @rd = Kgio::UNIXSocket.new(@path)
     @wr = @srv.kgio_tryaccept
diff --git a/test/test_unix_connect.rb b/test/test_unix_connect.rb
index 60cb8c0..7b19941 100644
--- a/test/test_unix_connect.rb
+++ b/test/test_unix_connect.rb
@@ -18,8 +18,7 @@ class TestKgioUnixConnect < Test::Unit::TestCase
     @tmpdir = Dir.mktmpdir('kgio_unix_1')
     tmp = Tempfile.new('kgio_unix_1', @tmpdir)
     @path = tmp.path
-    File.unlink(@path)
-    tmp.close rescue nil
+    tmp.close!
     @srv = Kgio::UNIXServer.new(@path)
     @addr = Socket.pack_sockaddr_un(@path)
   end
diff --git a/test/test_unix_server.rb b/test/test_unix_server.rb
index 02e4d8d..96769b1 100644
--- a/test/test_unix_server.rb
+++ b/test/test_unix_server.rb
@@ -8,8 +8,7 @@ class TestKgioUNIXServer < Test::Unit::TestCase
     @tmpdir = Dir.mktmpdir('kgio_unix_2')
     tmp = Tempfile.new('kgio_unix_2', @tmpdir)
     @path = tmp.path
-    File.unlink(@path)
-    tmp.close rescue nil
+    tmp.close!
     @srv = Kgio::UNIXServer.new(@path)
     @host = '127.0.0.1'
   end
diff --git a/test/test_unix_server_read_client_write.rb b/test/test_unix_server_read_client_write.rb
index a994e01..24581e1 100644
--- a/test/test_unix_server_read_client_write.rb
+++ b/test/test_unix_server_read_client_write.rb
@@ -7,8 +7,7 @@ class TestUnixServerReadClientWrite < Test::Unit::TestCase
     @tmpdir = Dir.mktmpdir('kgio_unix_3')
     tmp = Tempfile.new('kgio_unix_3', @tmpdir)
     @path = tmp.path
-    File.unlink(@path)
-    tmp.close rescue nil
+    tmp.close!
     @srv = Kgio::UNIXServer.new(@path)
     @wr = Kgio::UNIXSocket.new(@path)
     @rd = @srv.kgio_tryaccept
-- 
1.8.4



^ permalink raw reply related	[relevance 5%]

Results 1-4 of 4 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2013-09-07 20:07  5% [PATCH] Close tempfile and unlink it immediately Hleb Valoshka
2013-09-07 20:21  7% ` Eric Wong
2013-09-07 22:51  7%   ` Aeon
2013-09-11  0:29  4% [ANN] kgio 2.8.1 - minor improvements and test fixes Eric Wong

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

	https://yhbt.net/kgio.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).