PacketQ icon indicating copy to clipboard operation
PacketQ copied to clipboard

No error when file is not readable

Open Guigoz opened this issue 6 years ago • 1 comments

Hello,

First I would like to thank you for your great work on PacketQ! It's a blazzing fast tool!

Lately I've been surprised to see that PacketQ does not return any error when the file is not readable or does not exists.

$ /usr/local/bin/packetq -s "SELECT * FROM dns" /tmp/thisFileDoesNotExist                                           
[
  {
    "table_name": "result-0",
    "query": "SELECT * FROM dns",
    "head": [
      { "name": "id","type": "int" },
      { "name": "s","type": "int" },
      { "name": "us","type": "int" },
      { "name": "ether_type","type": "int" },
      { "name": "src_port","type": "int" },
      { "name": "dst_port","type": "int" },
      { "name": "src_addr","type": "text" },
      { "name": "dst_addr","type": "text" },
      { "name": "protocol","type": "int" },
      { "name": "ip_ttl","type": "int" },
      { "name": "ip_version","type": "int" },
      { "name": "fragments","type": "int" },
      { "name": "qname","type": "text" },
      { "name": "aname","type": "text" },
      { "name": "msg_id","type": "int" },
      { "name": "msg_size","type": "int" },
      { "name": "opcode","type": "int" },
      { "name": "rcode","type": "int" },
      { "name": "extended_rcode","type": "int" },
      { "name": "edns_version","type": "int" },
      { "name": "z","type": "int" },
      { "name": "udp_size","type": "int" },
      { "name": "qd_count","type": "int" },
      { "name": "an_count","type": "int" },
      { "name": "ns_count","type": "int" },
      { "name": "ar_count","type": "int" },
      { "name": "qtype","type": "int" },
      { "name": "qclass","type": "int" },
      { "name": "atype","type": "int" },
      { "name": "aclass","type": "int" },
      { "name": "attl","type": "int" },
      { "name": "aa","type": "bool" },
      { "name": "tc","type": "bool" },
      { "name": "rd","type": "bool" },
      { "name": "cd","type": "bool" },
      { "name": "ra","type": "bool" },
      { "name": "ad","type": "bool" },
      { "name": "do","type": "bool" },
      { "name": "edns0","type": "bool" },
      { "name": "qr","type": "bool" },
      { "name": "edns0_ecs","type": "bool" },
      { "name": "edns0_ecs_family","type": "int" },
      { "name": "edns0_ecs_source","type": "int" },
      { "name": "edns0_ecs_scope","type": "int" },
      { "name": "edns0_ecs_address","type": "text" }
    ],
    "data": [
    ]
  }
]

I think an error message and return code would be more suitable. What do you think of this?

Guillaume.

Guigoz avatar Mar 30 '18 09:03 Guigoz

Yes, that would definitively be more suitable, but it would require a major version bump. Could add an error to the output but that would only work for JSON and XML, hmm...

jelu avatar Apr 03 '18 08:04 jelu