rpm -q just exits silently when fed an unsupported file or a dir:
rpm -qp /bin # directory
rpm -qp /bin/rpm # binary file
The exit status is fine (1). I'd additionally expect to see some kind of an error message.
Yup, fixed upstream now...
...and rawhide too now (rpm-4.5.90-0.git8514.1)