unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH 0/2] drop Ruby 1.9.3 support, require 2.0+
@ 2021-09-14 23:39 Eric Wong
  2021-09-14 23:39 ` [PATCH 1/2] drop Ruby 1.9.3 support, require 2.0+ for now Eric Wong
  2021-09-14 23:39 ` [PATCH 2/2] drop unnecessary IO#close_on_exec=true assignment Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2021-09-14 23:39 UTC (permalink / raw)
  To: unicorn-public

Eventually, I'd like to move towards newer versions of Ruby
(e.g. 2.3+ has more *_nonblock stuff).  For now, this is a small
step and hopefully won't cause problems for maintainers of
legacy systems...

Eric Wong (2):
  drop Ruby 1.9.3 support, require 2.0+ for now
  drop unnecessary IO#close_on_exec=true assignment

 HACKING                          |  2 +-
 README                           |  3 +--
 Sandbox                          |  2 +-
 ext/unicorn_http/extconf.rb      |  4 ++--
 ext/unicorn_http/unicorn_http.rl | 14 +-------------
 lib/unicorn.rb                   |  2 --
 lib/unicorn/http_server.rb       |  2 +-
 t/README                         |  2 +-
 unicorn.gemspec                  |  4 ++--
 9 files changed, 10 insertions(+), 25 deletions(-)

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

* [PATCH 1/2] drop Ruby 1.9.3 support, require 2.0+ for now
  2021-09-14 23:39 [PATCH 0/2] drop Ruby 1.9.3 support, require 2.0+ Eric Wong
@ 2021-09-14 23:39 ` Eric Wong
  2021-09-14 23:39 ` [PATCH 2/2] drop unnecessary IO#close_on_exec=true assignment Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2021-09-14 23:39 UTC (permalink / raw)
  To: unicorn-public

Ruby 1.9.3 was released nearly a decade ago, so there's probably
few (if any) legacy users left, and they can continue using old
versions of unicorn.  We'll be able to take advantage of some
Ruby 2.0+-only features down the road (and hopefully 2.3+).

Also, I no longer have a installation of Ruby 1.8 and getting it
working probably isn't worth the effort, so 4.x support is gone.
---
 HACKING                          |  2 +-
 README                           |  3 +--
 Sandbox                          |  2 +-
 ext/unicorn_http/extconf.rb      |  4 ++--
 ext/unicorn_http/unicorn_http.rl | 14 +-------------
 lib/unicorn/http_server.rb       |  2 +-
 t/README                         |  2 +-
 unicorn.gemspec                  |  4 ++--
 8 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/HACKING b/HACKING
index 976bf92..7c41eba 100644
--- a/HACKING
+++ b/HACKING
@@ -63,7 +63,7 @@ becomes unavailable.
 
 === Ruby/C Compatibility
 
-We target mainline Ruby 1.9.3 and later.  We need the Ruby
+We target C Ruby 2.0 and later.  We need the Ruby
 implementation to support fork, exec, pipe, UNIX signals, access to
 integer file descriptors and ability to use unlinked files.
 
diff --git a/README b/README
index 35a7388..5fdd1e8 100644
--- a/README
+++ b/README
@@ -12,8 +12,7 @@ both the the request and response in between unicorn and slow clients.
   cut out everything that is better supported by the operating system,
   {nginx}[https://nginx.org/] or {Rack}[https://rack.github.io/].
 
-* Compatible with Ruby 1.9.3 and later.
-  unicorn 4.x remains supported for Ruby 1.8 users.
+* Compatible with Ruby 2.0.0 and later.
 
 * Process management: unicorn will reap and restart workers that
   die from broken apps.  There is no need to manage multiple processes
diff --git a/Sandbox b/Sandbox
index 651e5cd..d770586 100644
--- a/Sandbox
+++ b/Sandbox
@@ -87,7 +87,7 @@ For now workarounds include doing one of the following:
 
 3. Explicitly setting RUBYLIB or $LOAD_PATH to include any gem path
    where the unicorn gem is installed
-   (e.g. /usr/lib/ruby/gems/1.9.3/gems/unicorn-VERSION/lib)
+   (e.g. /usr/lib/ruby/gems/3.0.0/gems/unicorn-VERSION/lib)
 
 === RUBYOPT pollution from SIGUSR2 upgrades
 
diff --git a/ext/unicorn_http/extconf.rb b/ext/unicorn_http/extconf.rb
index 95514bc..8bdc1c9 100644
--- a/ext/unicorn_http/extconf.rb
+++ b/ext/unicorn_http/extconf.rb
@@ -9,8 +9,8 @@
 have_macro("SIZEOF_OFF_T", "ruby.h") or check_sizeof("off_t", "sys/types.h")
 have_macro("SIZEOF_SIZE_T", "ruby.h") or check_sizeof("size_t", "sys/types.h")
 have_macro("SIZEOF_LONG", "ruby.h") or check_sizeof("long", "sys/types.h")
-have_func("rb_str_set_len", "ruby.h") or abort 'Ruby 1.9.3+ required'
-have_func("rb_hash_clear", "ruby.h") # Ruby 2.0+
+have_func("rb_str_set_len", "ruby.h") or abort 'Ruby 2.0+ required'
+have_func("rb_hash_clear", "ruby.h") or abort 'Ruby 2.0+ required'
 have_func("gmtime_r", "time.h")
 
 message('checking if String#-@ (str_uminus) dedupes... ')
diff --git a/ext/unicorn_http/unicorn_http.rl b/ext/unicorn_http/unicorn_http.rl
index 21e09d6..e934a32 100644
--- a/ext/unicorn_http/unicorn_http.rl
+++ b/ext/unicorn_http/unicorn_http.rl
@@ -65,18 +65,6 @@ struct http_parser {
 static ID id_set_backtrace, id_is_chunked_p;
 static VALUE cHttpParser;
 
-#ifdef HAVE_RB_HASH_CLEAR /* Ruby >= 2.0 */
-#  define my_hash_clear(h) (void)rb_hash_clear(h)
-#else /* !HAVE_RB_HASH_CLEAR - Ruby <= 1.9.3 */
-
-static ID id_clear;
-
-static void my_hash_clear(VALUE h)
-{
-  rb_funcall(h, id_clear, 0);
-}
-#endif /* HAVE_RB_HASH_CLEAR */
-
 static void finalize_header(struct http_parser *hp);
 
 static void parser_raise(VALUE klass, const char *msg)
@@ -650,7 +638,7 @@ static VALUE HttpParser_clear(VALUE self)
     return HttpParser_init(self);
 
   http_parser_init(hp);
-  my_hash_clear(hp->env);
+  rb_hash_clear(hp->env);
 
   return self;
 }
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 22f067f..cd6e63b 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -609,7 +609,7 @@ def e103_response_write(client, headers)
   def e100_response_write(client, env)
     # We use String#freeze to avoid allocations under Ruby 2.1+
     # Not many users hit this code path, so it's better to reduce the
-    # constant table sizes even for 1.9.3-2.0 users who'll hit extra
+    # constant table sizes even for Ruby 2.0 users who'll hit extra
     # allocations here.
     client.write(@request.response_start_sent ?
                  "100 Continue\r\n\r\nHTTP/1.1 ".freeze :
diff --git a/t/README b/t/README
index 0d9b697..14de559 100644
--- a/t/README
+++ b/t/README
@@ -10,7 +10,7 @@ comfortable writing integration tests with.
 
 == Requirements
 
-* {Ruby 1.9.3+}[https://www.ruby-lang.org/en/] (duh!)
+* {Ruby 2.0.0+}[https://www.ruby-lang.org/en/] (duh!)
 * {GNU make}[https://www.gnu.org/software/make/]
 * {socat}[http://www.dest-unreach.org/socat/]
 * {curl}[https://curl.haxx.se/]
diff --git a/unicorn.gemspec b/unicorn.gemspec
index 90e64d4..9230199 100644
--- a/unicorn.gemspec
+++ b/unicorn.gemspec
@@ -25,11 +25,11 @@
   s.homepage = 'https://yhbt.net/unicorn/'
   s.test_files = test_files
 
-  # 1.9.3 is the minumum supported version. We don't specify
+  # 2.0.0 is the minumum supported version. We don't specify
   # a maximum version to make it easier to test pre-releases,
   # but we do warn users if they install unicorn on an untested
   # version in extconf.rb
-  s.required_ruby_version = ">= 1.9.3"
+  s.required_ruby_version = ">= 2.0.0"
 
   # We do not have a hard dependency on rack, it's possible to load
   # things which respond to #call.  HTTP status lines in responses

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

* [PATCH 2/2] drop unnecessary IO#close_on_exec=true assignment
  2021-09-14 23:39 [PATCH 0/2] drop Ruby 1.9.3 support, require 2.0+ Eric Wong
  2021-09-14 23:39 ` [PATCH 1/2] drop Ruby 1.9.3 support, require 2.0+ for now Eric Wong
@ 2021-09-14 23:39 ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2021-09-14 23:39 UTC (permalink / raw)
  To: unicorn-public

Ruby 2.0+ sets FD_CLOEXEC by default on all FDs.
---
 lib/unicorn.rb | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index d5991fe..1a50631 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -114,8 +114,6 @@ def self.log_error(logger, prefix, exc)
 
   def self.pipe # :nodoc:
     Kgio::Pipe.new.each do |io|
-      io.close_on_exec = true  # remove this when we only support Ruby >= 2.0
-
       # shrink pipes to minimize impact on /proc/sys/fs/pipe-user-pages-soft
       # limits.
       if defined?(F_SETPIPE_SZ)

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

end of thread, other threads:[~2021-09-14 23:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14 23:39 [PATCH 0/2] drop Ruby 1.9.3 support, require 2.0+ Eric Wong
2021-09-14 23:39 ` [PATCH 1/2] drop Ruby 1.9.3 support, require 2.0+ for now Eric Wong
2021-09-14 23:39 ` [PATCH 2/2] drop unnecessary IO#close_on_exec=true assignment Eric Wong

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

	../../../unicorn.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).