ansigenome icon indicating copy to clipboard operation
ansigenome copied to clipboard

parser fails due to "Too many levels of symbolic links"

Open kwoodson opened this issue 6 years ago • 1 comments

I attempted to run this on my repository to get a feel for what our graph looks like and it failed with the error message:

Traceback (most recent call last):
  File "./ansigenome", line 326, in <module>
    main()
  File "./ansigenome", line 322, in main
    fn(args, options, reloaded_config, parser)
  File "./ansigenome", line 153, in execute_scan
    Scan(args, options, config)
  File "/home/kwoodson/git/ansigenome/ansigenome/scan.py", line 83, in __init__
    self.scan_roles()
  File "/home/kwoodson/git/ansigenome/ansigenome/scan.py", line 117, in scan_roles
    self.report["roles"][key] = self.report_role(key)
  File "/home/kwoodson/git/ansigenome/ansigenome/scan.py", line 185, in report_role
    "total_lines": self.gather_lines(),
  File "/home/kwoodson/git/ansigenome/ansigenome/scan.py", line 315, in gather_lines
    with open(full_path, "r") as f:
IOError: [Errno 40] Too many levels of symbolic links: '/home/kwoodson/git/openshift-ansible/roles/openshift_certificate_expiry/examples/playbooks/roles/openshift_certificate_expiry/examples/playbooks/roles/openshift_certificate_expiry/examples/playbooks/roles/openshift_certificate_expiry/examples/playbooks/roles/openshift_certificate_expiry/examples/playbooks/roles/openshift_certificate_expiry/examples/playbooks/roles/openshift_certificate_expiry/examples/playbooks/roles/openshift_certificate_expiry/examples/playbooks/roles/openshift_certificate_expiry/examples/playbooks/roles/openshift_certificate_expiry/examples/playbooks/roles/openshift_certificate_expiry/examples/playbooks/roles/openshift_certificate_expiry/examples/playbooks/roles/openshift_certificate_expiry/examples/playbooks/roles/openshift_certificate_expiry/examples/playbooks'

It looks like it started doing a recursive decent and was broken by the symlinks.

Possible fixes:

  • Keep a hash of the paths that have been covered as to not descend more than once.
  • Add flag --no-symlinks

If I can find some time I'll look at submitting a patch.

kwoodson avatar Oct 09 '17 13:10 kwoodson

Thanks for reporting in.

I'd really appreciate if you could look into patching that as it does seem like a legit bug.

nickjj avatar Oct 10 '17 12:10 nickjj