chrislee35/passivedns-client

/usr/local/bin/pdnstool: invalid option -- e

Closed this issue · 15 comments

uname -a
Linux remnux-virt 3.13.0-52-generic #86-Ubuntu SMP Mon May 4 04:32:59 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

remnux@remnux-virt:~$ pdnstool -d3 www.google.com
/usr/local/bin/pdnstool: invalid option -- e
/usr/lib/ruby/1.9.1/getoptlong.rb:394:in `set_error': invalid option -- e (GetoptLong::InvalidOption)
        from /usr/lib/ruby/1.9.1/getoptlong.rb:571:in `get'
        from /usr/lib/ruby/1.9.1/getoptlong.rb:602:in `block in each'
        from /usr/lib/ruby/1.9.1/getoptlong.rb:601:in `loop'
        from /usr/lib/ruby/1.9.1/getoptlong.rb:601:in `each'
        from /var/lib/gems/1.9.1/gems/passivedns-client-2.1.2/lib/passivedns/client/cli.rb:80:in `parse_command_line'
        from /var/lib/gems/1.9.1/gems/passivedns-client-2.1.2/lib/passivedns/client/cli.rb:256:in `run'
        from /var/lib/gems/1.9.1/gems/passivedns-client-2.1.2/bin/pdnstool:5:in `<top (required)>'
        from /usr/local/bin/pdnstool:23:in `load'
        from /usr/local/bin/pdnstool:23:in `<main>'
remnux@remnux-virt:~$

I tried to reproduce this error earlier, but failed. I'll look into it more tonight.

I couldn't reproduce it, so I'm assuming that I made an error when I packaged the gem. I bumped the version to 2.1.3. Please let me know if that fixes the problem.

Still the same

remnux@REMnux:~$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
remnux@REMnux:~$ sudo gem install passivedns-client
Successfully installed passivedns-client-2.1.3
1 gem installed
Installing ri documentation for passivedns-client-2.1.3...
Installing RDoc documentation for passivedns-client-2.1.3...
remnux@REMnux:~$ pdnstool -db google.com
/usr/local/bin/pdnstool: invalid option -- e
/usr/lib/ruby/1.9.1/getoptlong.rb:394:in `set_error': invalid option -- e (GetoptLong::InvalidOption)
        from /usr/lib/ruby/1.9.1/getoptlong.rb:571:in `get'
        from /usr/lib/ruby/1.9.1/getoptlong.rb:602:in `block in each'
        from /usr/lib/ruby/1.9.1/getoptlong.rb:601:in `loop'
        from /usr/lib/ruby/1.9.1/getoptlong.rb:601:in `each'
        from /var/lib/gems/1.9.1/gems/passivedns-client-2.1.3/lib/passivedns/client/cli.rb:80:in `parse_command_line'
        from /var/lib/gems/1.9.1/gems/passivedns-client-2.1.3/lib/passivedns/client/cli.rb:256:in `run'
        from /var/lib/gems/1.9.1/gems/passivedns-client-2.1.3/bin/pdnstool:5:in `<top (required)>'
        from /usr/local/bin/pdnstool:23:in `load'
        from /usr/local/bin/pdnstool:23:in `<main>'
remnux@REMnux:~$

Tested on another system and works as expected. Im guessing its something wrong with my environment.

Thanks.

On Ubuntu 14.10, it ran without issue:
Linux ubuntu 3.16.0-34-generic #47-Ubuntu SMP Fri Apr 10 18:02:58 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Ruby 1.9.1 installed from apt-get

I also tried on Ubuntu 14.04. Again, it ran without issue:
Linux ubuntu 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

I looked at the code closely and could figure out what would cause this error. I'll try some older Ubuntus tomorrow.

Kev -

Which version of REMnux are you working from? Is it the current stable, older, or the new beta?

Regards,

Drew

On May 19, 2015, at 7:29 AM, kevthehermit notifications@github.com wrote:

Still the same

remnux@REMnux:$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
remnux@REMnux:
$ sudo gem install passivedns-client
Successfully installed passivedns-client-2.1.3
1 gem installed
Installing ri documentation for passivedns-client-2.1.3...
Installing RDoc documentation for passivedns-client-2.1.3...
remnux@REMnux:$ pdnstool -db google.com
/usr/local/bin/pdnstool: invalid option -- e
/usr/lib/ruby/1.9.1/getoptlong.rb:394:in set_error': invalid option -- e (GetoptLong::InvalidOption) from /usr/lib/ruby/1.9.1/getoptlong.rb:571:inget'
from /usr/lib/ruby/1.9.1/getoptlong.rb:602:in block in each' from /usr/lib/ruby/1.9.1/getoptlong.rb:601:inloop'
from /usr/lib/ruby/1.9.1/getoptlong.rb:601:in each' from /var/lib/gems/1.9.1/gems/passivedns-client-2.1.3/lib/passivedns/client/cli.rb:80:inparse_command_line'
from /var/lib/gems/1.9.1/gems/passivedns-client-2.1.3/lib/passivedns/client/cli.rb:256:in run' from /var/lib/gems/1.9.1/gems/passivedns-client-2.1.3/bin/pdnstool:5:in<top (required)>'
from /usr/local/bin/pdnstool:23:in load' from /usr/local/bin/pdnstool:23:in

'
remnux@REMnux:$

Tested on another system and works as expected. Im guessing its something wrong with my environment.

Thanks.


Reply to this email directly or view it on GitHub #9 (comment).

Drew,

This is the new Remnux beta build for V6.

Going to take a close look tonight. Works fine on all my other systems.

Any news?

Not yet. I got access to the REMnux beta overlay but have yet to install it.

-D

On May 23, 2015, at 8:03 AM, Chris Lee notifications@github.com wrote:

Any news?


Reply to this email directly or view it on GitHub.

I’m on a fresh Ubuntu 14.04 with Remnux and confirm the behavior.

Regards,

Drew

On May 19, 2015, at 7:29 AM, kevthehermit notifications@github.com wrote:

pdnstool -db google.com http://google.com/

Calling the pdnstool.rb directly using ruby appears to work.

1 ahunt@remnux:~⟫ ruby /var/lib/gems/1.9.1/gems/passivedns-client-2.1.3/bin/pdnstool -db google.com
source response_time query answer rrtype ttl firstseen lastseen count
BFK.de 1.651230242 google.com 129.143.66.38 A
BFK.de 1.651230242 google.com 74.125.130.101 A
BFK.de 1.651230242 google.com 74.125.130.102 A
BFK.de 1.651230242 google.com 74.125.130.100 A
BFK.de 1.651230242 google.com 64.15.112.98 A
BFK.de 1.651230242 google.com 64.15.112.99 A
BFK.de 1.651230242 google.com 129.143.66.30 A
BFK.de 1.651230242 google.com 64.15.112.93 A
BFK.de 1.651230242 google.com 64.15.112.94 A
BFK.de 1.651230242 google.com 64.15.112.29 A

Maybe there is an issue with the /usr/local/bin/pdnstool wrapper.

Regards,

Drew

On May 23, 2015, at 10:13 PM, Irrational Pi pinowudi@gmail.com wrote:

I’m on a fresh Ubuntu 14.04 with Remnux and confirm the behavior.

Regards,

Drew

On May 19, 2015, at 7:29 AM, kevthehermit <notifications@github.com mailto:notifications@github.com> wrote:

pdnstool -db google.com http://google.com/

Confirmed that the /usr/bin/pdnstool gem wrapper on my Mac and the /usr/local/bin/pdnstool wrapper on the Ubuntu/Remnux are the same except for the shell line. Looks as follows.

#!/usr/bin/ruby1.9.1

This file was generated by RubyGems.

The application 'passivedns-client' is installed as part of a gem, and

this file is here to facilitate running it.

require 'rubygems'

version = ">= 0"

if ARGV.first
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
if str =~ /\A_(.*)_\z/
version = $1
ARGV.shift
end
end

gem 'passivedns-client', version
load Gem.bin_path('passivedns-client', 'pdnstool', version)

Unsure why the Ubuntu version does not seem to be passing the argument correctly.

Regards,

Drew

On May 23, 2015, at 10:25 PM, Irrational Pi pinowudi@gmail.com wrote:

Calling the pdnstool.rb directly using ruby appears to work.

1 ahunt@remnux:~⟫ ruby /var/lib/gems/1.9.1/gems/passivedns-client-2.1.3/bin/pdnstool -db google.com http://google.com/
source response_time query answer rrtype ttl firstseen lastseen count
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 129.143.66.38 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 74.125.130.101 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 74.125.130.102 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 74.125.130.100 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 64.15.112.98 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 64.15.112.99 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 129.143.66.30 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 64.15.112.93 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 64.15.112.94 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 64.15.112.29 A

Maybe there is an issue with the /usr/local/bin/pdnstool wrapper.

Regards,

Drew

On May 23, 2015, at 10:13 PM, Irrational Pi <pinowudi@gmail.com mailto:pinowudi@gmail.com> wrote:

I’m on a fresh Ubuntu 14.04 with Remnux and confirm the behavior.

Regards,

Drew

On May 19, 2015, at 7:29 AM, kevthehermit <notifications@github.com mailto:notifications@github.com> wrote:

pdnstool -db google.com http://google.com/

CC: Lenny Zeltser for Remnux feedback.

Oh boy. Ubuntu 14.04 appears to have major ruby issues. even if requesting v2.0, installs 1.9 by default.

http://askubuntu.com/questions/452243/install-ruby-2-0-without-ruby-switch http://askubuntu.com/questions/452243/install-ruby-2-0-without-ruby-switch

//Tried this:
$ sudo apt-get remove ruby ruby1.9.1 ruby2.0
$ sudo add-apt-repository ppa:brightbox/ruby-ng
$ sudo apt-get update
$ sudo apt-get install ruby2.1 ruby2.1-dev
$ sudo gem install passivedns-client
$ pdnstool -h
// still fails, same errors. Not a ruby version issue.
$ pdnstool -db google.com
/usr/local/bin/pdnstool: invalid option -- e
/usr/lib/ruby/2.1.0/getoptlong.rb:394:in set_error': invalid option -- e (GetoptLong::InvalidOption) from /usr/lib/ruby/2.1.0/getoptlong.rb:571:inget'
from /usr/lib/ruby/2.1.0/getoptlong.rb:602:in block in each' from /usr/lib/ruby/2.1.0/getoptlong.rb:601:inloop'
from /usr/lib/ruby/2.1.0/getoptlong.rb:601:in each' from /var/lib/gems/2.1.0/gems/passivedns-client-2.1.3/lib/passivedns/client/cli.rb:80:inparse_command_line'
from /var/lib/gems/2.1.0/gems/passivedns-client-2.1.3/lib/passivedns/client/cli.rb:256:in run' from /var/lib/gems/2.1.0/gems/passivedns-client-2.1.3/bin/pdnstool:5:in<top (required)>'
from /usr/local/bin/pdnstool:23:in load' from /usr/local/bin/pdnstool:23:in

'

//However, manually calling ruby works fine.

$ ruby /var/lib/gems/2.1.0/gems/passivedns-client-2.1.3/bin/pdnstool -db google.com
source response_time query answer rrtype ttl firstseen lastseencount
BFK.de 1.615518941 google.com 129.143.66.38 A
BFK.de 1.615518941 google.com 74.125.130.101 A
BFK.de 1.615518941 google.com 74.125.130.102 A
BFK.de 1.615518941 google.com 74.125.130.100 A
BFK.de 1.615518941 google.com 64.15.112.98 A
BFK.de 1.615518941 google.com 64.15.112.99 A
BFK.de 1.615518941 google.com 129.143.66.30 A

Not sure what’s afoot here. There is something about that gem wrapper at /usr/local/bin/pdnstool that is not passing the ARGV correctly and passing it to ruby. I couldn’t get it to run by executing the script line-by-line in the ruby interpreter either. Chris, is this a version issue or is Ruby in Ubuntu 14.04 just broken?

Regards,

Drew

On May 23, 2015, at 10:29 PM, Irrational Pi pinowudi@gmail.com wrote:

Confirmed that the /usr/bin/pdnstool gem wrapper on my Mac and the /usr/local/bin/pdnstool wrapper on the Ubuntu/Remnux are the same except for the shell line. Looks as follows.

#!/usr/bin/ruby1.9.1

This file was generated by RubyGems.

The application 'passivedns-client' is installed as part of a gem, and

this file is here to facilitate running it.

require 'rubygems'

version = ">= 0"

if ARGV.first
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
if str =~ /\A_(.*)_\z/
version = $1
ARGV.shift
end
end

gem 'passivedns-client', version
load Gem.bin_path('passivedns-client', 'pdnstool', version)

Unsure why the Ubuntu version does not seem to be passing the argument correctly.

Regards,

Drew

On May 23, 2015, at 10:25 PM, Irrational Pi pinowudi@gmail.com wrote:

Calling the pdnstool.rb directly using ruby appears to work.

1 ahunt@remnux:~⟫ ruby /var/lib/gems/1.9.1/gems/passivedns-client-2.1.3/bin/pdnstool -db google.com http://google.com/
source response_time query answer rrtype ttl firstseen lastseen count
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 129.143.66.38 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 74.125.130.101 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 74.125.130.102 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 74.125.130.100 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 64.15.112.98 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 64.15.112.99 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 129.143.66.30 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 64.15.112.93 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 64.15.112.94 A
BFK.de http://bfk.de/ 1.651230242 google.com http://google.com/ 64.15.112.29 A

Maybe there is an issue with the /usr/local/bin/pdnstool wrapper.

Regards,

Drew

On May 23, 2015, at 10:13 PM, Irrational Pi <pinowudi@gmail.com mailto:pinowudi@gmail.com> wrote:

I’m on a fresh Ubuntu 14.04 with Remnux and confirm the behavior.

Regards,

Drew

On May 19, 2015, at 7:29 AM, kevthehermit <notifications@github.com mailto:notifications@github.com> wrote:

pdnstool -db google.com http://google.com/

It works fine in my Ubuntu 14.04 and 14.10 VMs. I requested access to Remnux but haven't received a reply. In Ubuntu 14.04, I have Ruby 1.9.3 and 1.9.1 (both installed via apt). I installed the gem with 1.9.1 and the gem is running in 1.9.1. I can confirm that by suspending the process (CTRL-Z) and looking at the output from ps wax.
So far, I cannot reproduce the problem. I can, however, provide a workaround that doesn't error out with the -e flag... A bit hackish, but I'm not proud.

I'm wondering whether the issue was due to an alias that was present on REMnux, which wrapped itself around pdnstool and messed with the parameters. I've removed the alias in the latest REMnux v6 beta and I think this might have addressed the issue. Thanks for catching this!

Everything seems to work in the latest beta, so I'm going to close the ticket now.