Bug 243438 - dns/dnsviz: dnsviz graph fails with "No such file or directory while opening share/dnsviz/..."
Summary: dns/dnsviz: dnsviz graph fails with "No such file or directory while opening ...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Kurt Jaeger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-18 20:54 UTC by John W. O'Brien
Modified: 2022-12-28 18:08 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (pi)


Attachments
DNSViz probe output (39.55 KB, application/json)
2022-12-28 18:07 UTC, John W. O'Brien
no flags Details
DNSViz graph output (91.54 KB, text/html)
2022-12-28 18:08 UTC, John W. O'Brien
no flags Details
DNSViz graph display (337.42 KB, image/png)
2022-12-28 18:08 UTC, John W. O'Brien
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description John W. O'Brien 2020-01-18 20:54:13 UTC
Synopsis
========

The graph subcommand is unable to access files in the share directory.


$ dnsviz graph -Thtml -O -r example.json
/usr/local/lib/python3.7/site-packages/pygraphviz/agraph.py:1367: RuntimeWarning: Warning: No such file or directory while opening share/dnsviz/icons/error.png
Error: No or improper image file="share/dnsviz/icons/error.png"
in label of edge RRset-10|example.com|NS -> DNSKEY-3|example.com|8|58821
Warning: No such file or directory while opening share/dnsviz/icons/error.png
Error: No or improper image file="share/dnsviz/icons/error.png"
in label of edge RRset-11|example.com|A -> DNSKEY-3|example.com|8|58821
Warning: No such file or directory while opening share/dnsviz/icons/error.png
Error: No or improper image file="share/dnsviz/icons/error.png"
in label of edge RRset-13|example.com|MX -> DNSKEY-3|example.com|8|58821
Warning: No such file or directory while opening share/dnsviz/icons/error.png
Error: No or improper image file="share/dnsviz/icons/error.png"
in label of edge RRset-14|example.com|AAAA -> DNSKEY-3|example.com|8|58821
Warning: No such file or directory while opening share/dnsviz/icons/error.png
Error: No or improper image file="share/dnsviz/icons/error.png"
in label of edge NSEC-2|fbl5gzdn98.example.com|A -> DNSKEY-3|example.com|8|58821

  warnings.warn(b"".join(errors).decode(self.encoding), RuntimeWarning)
Error reading template file "share/dnsviz/html/dnssec-template.html": No such file or directory


Analysis
========

/usr/local/lib/python3.7/site-packages/dnsviz/config.py sets

    _prefix = ''

instead of

    _prefix = '/usr/local'

During the package building process, it appears that install_data is only populated with the real prefix during the stage target, by which point a copy of config.py has already been generated with the empty prefix.
Comment 1 Kurt Jaeger freebsd_committer freebsd_triage 2022-12-27 21:11:57 UTC
I tried with with dnsviz-0.9.4 and:

cd dns/dnsviz/work-py38/dnsviz-0.9.4/tests/data
dnsviz graph -Thtml -O -r example-authoritative.json

and it creates an example.com.html and an example.net.html, but the browser
does not display anything if viewing this.

So I have problems reproducing this with a newer dnsviz.

Any hints ?
Comment 2 John W. O'Brien 2022-12-27 21:50:34 UTC
(In reply to Kurt Jaeger from comment #1)

Were you able to reproduce with 0.9.2? What is the value of `_prefix` in config.py when it runs to completion without warnings or errors?

% curl -O http://pkg.freebsd.org/FreeBSD:13:amd64/latest/All/dnsviz-0.9.2.pkg
% tar -xJf dnsviz-0.9.2.pkg --strip-components 7 \
    /usr/local/lib/python3.9/site-packages/dnsviz/config.py
% grep ^_prefix config.py
_prefix = ''

I would be glad to re-test with 0.9.4, if you would like to supply a patch against the latest ports tree.
Comment 3 Kurt Jaeger freebsd_committer freebsd_triage 2022-12-27 22:22:46 UTC
(In reply to John W. O'Brien from comment #2)
I tried it with both '' or '/usr/local'. no change.

There's no example.json in 0.9.4, and I did not find a an example.json
in the 0.9.2 source ?
Comment 4 John W. O'Brien 2022-12-28 17:36:16 UTC
(In reply to Kurt Jaeger from comment #3)

The example.json was the output of

    dnsviz probe -o example.json example.com

Three years ago I was unable to run graph on anything. Now? I'm not able to reproduce the problem anymore on 0.9.2 with python 3.10 nor 3.7.

Oh, well. Thanks for looking into it.
Comment 5 Kurt Jaeger freebsd_committer freebsd_triage 2022-12-28 17:54:24 UTC
When I do the same steps you described, I get an approx. 90 KB large
example.com.html file, but if I look at it in the browser, nothing is displayed.

What should be displayed ?
Comment 6 John W. O'Brien 2022-12-28 18:07:46 UTC
Created attachment 239090 [details]
DNSViz probe output

Output of:

    dnsviz probe -o example.json example.com
Comment 7 John W. O'Brien 2022-12-28 18:08:24 UTC
Created attachment 239091 [details]
DNSViz graph output

Output of:

    dnsviz graph -Thtml -O -r example.json
Comment 8 John W. O'Brien 2022-12-28 18:08:57 UTC
Created attachment 239092 [details]
DNSViz graph display