On Fri, Nov 1, 2013 at 4:07 PM, Eric Wong <[email protected]> wrote:
> "Ernest W. Durbin III" <[email protected]> wrote:
>> Gist containing configs and logs:
>> https://gist.github.com/ewdurbin/1d9d2ea14a4231a5e7cc
>
> I was stumped until I saw your command-line:
>
>   "-p", "/var/run/marketing-staging/unicorn.pid"
>
> PID file path is '-P' (but we recommend using the config file for that)
>
> Pushing out the following:

Gorgeous! Thank you for the swift response.

> ------------------------8<------------------------------------
> Subject: [PATCH] bin/*: enforce -p/--port argument to be a valid integer
>
> Users may confuse '-p' with the (to-be-deprecated) '-P/--pid'
> option, leading to surprising behavior if a pathname is passed as a
> port, because String#to_i would convert it to zero, causing:
>
>     TCPServer.new(host, port = 0)
>
> to bind to a random, unused port.
> ---
>  bin/unicorn       | 6 +++---
>  bin/unicorn_rails | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/bin/unicorn b/bin/unicorn
> index 01984f8..c272e43 100755
> --- a/bin/unicorn
> +++ b/bin/unicorn
> @@ -47,9 +47,9 @@ op = OptionParser.new("", 24, '  ') do |opts|
>      rackup_opts[:set_listener] = true
>    end
>
> -  opts.on("-p", "--port PORT",
> -          "use PORT (default: #{Unicorn::Const::DEFAULT_PORT})") do |p|
> -    rackup_opts[:port] = p.to_i
> +  opts.on("-p", "--port PORT", Integer,
> +          "use PORT (default: #{Unicorn::Const::DEFAULT_PORT})") do |port|
> +    rackup_opts[:port] = port
>      rackup_opts[:set_listener] = true
>    end
>
> diff --git a/bin/unicorn_rails b/bin/unicorn_rails
> index 4bd599f..b080846 100755
> --- a/bin/unicorn_rails
> +++ b/bin/unicorn_rails
> @@ -48,9 +48,9 @@ op = OptionParser.new("", 24, '  ') do |opts|
>      rackup_opts[:set_listener] = true
>    end
>
> -  opts.on("-p", "--port PORT",
> -          "use PORT (default: #{Unicorn::Const::DEFAULT_PORT})") do |p|
> -    rackup_opts[:port] = p.to_i
> +  opts.on("-p", "--port PORT", Integer,
> +          "use PORT (default: #{Unicorn::Const::DEFAULT_PORT})") do |port|
> +    rackup_opts[:port] = port
>      rackup_opts[:set_listener] = true
>    end
>
> _______________________________________________
> Unicorn mailing list - [email protected]
> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
> Do not quote signatures (like this one) or top post when replying
_______________________________________________
Unicorn mailing list - [email protected]
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

Reply via email to