Skip to content

prettyprint.rb:180:in text': undefined method length' for nil:NilClass (NoMethodError) #8

@marek22k

Description

@marek22k

Hello,

I was reporting an issue with the dnsruby library and was referred here. alexdalitz/dnsruby#183


Hello,

I wanted to write a small script with Ruby that does zonewalking. For this I set dnssec to true and set the authoitive nameserver because it allows "ANY" requests. After that I wanted to print the result with pp and got an error.

require "dnsruby"

resolver = Dnsruby::Resolver.new
resolver.nameserver = "ns1.he.net"
resolver.dnssec = true

pp resolver.query("walking.zonewalking.de", "ANY").answer
[#<Dnsruby::RR::IN::A:0x00007f06ddb4c928
  @address=#<Dnsruby::IPv4 5.45.109.122>,
  @klass=IN,
  @name=#<Dnsruby::Name: walking.zonewalking.de.>,
  @rdata=#<Dnsruby::IPv4 5.45.109.122>,
  @ttl=10800,
  @type=A>,
 #<Dnsruby::RR::IN::RRSIG:0x00007f06ddb50870/home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:180:in `text': undefined method `length' for nil:NilClass (NoMethodError)

  def text(obj, width=obj.length)
                         ^^^^^^^
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:324:in `pretty_print'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:197:in `block in pp'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:253:in `block (2 levels) in group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:280:in `nest'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:252:in `block in group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:265:in `group_sub'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:251:in `group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:197:in `pp'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:274:in `block (3 levels) in pp_object'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:253:in `block (2 levels) in group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:280:in `nest'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:252:in `block in group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:265:in `group_sub'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:251:in `group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:272:in `block (2 levels) in pp_object'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:260:in `block in seplist'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:254:in `each'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:254:in `seplist'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:267:in `block in pp_object'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:253:in `block (2 levels) in group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:280:in `nest'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:252:in `block in group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:265:in `group_sub'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:251:in `group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:215:in `object_address_group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:266:in `pp_object'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:328:in `pretty_print'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:197:in `block in pp'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:253:in `block (2 levels) in group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:280:in `nest'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:252:in `block in group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:265:in `group_sub'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:251:in `group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:197:in `pp'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:369:in `block (2 levels) in pretty_print'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:260:in `block in seplist'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:254:in `each'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:254:in `seplist'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:368:in `block in pretty_print'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:253:in `block (2 levels) in group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:280:in `nest'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:252:in `block in group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:265:in `group_sub'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:251:in `group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:367:in `pretty_print'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:197:in `block in pp'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:253:in `block (2 levels) in group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:280:in `nest'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:252:in `block in group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:265:in `group_sub'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/prettyprint.rb:251:in `group'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:197:in `pp'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:93:in `block in pp'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:154:in `guard_inspect_key'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:93:in `pp'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:626:in `block in pp'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:625:in `each'
	from /home/marek/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/pp.rb:625:in `pp'
	from <internal:prelude>:15:in `pp'
	from walk.rb:8:in `<main>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions