clang-view cannot import module ScanView

Bug #1660622 reported by Kai Kratz
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
llvm-toolchain-3.9 (Debian)
Fix Released
Unknown
llvm-toolchain-3.9 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Fresh package from today still has the problem of clang-view unable to import module ScanView.

This is the same bug as in: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=838572

Proposed fix does work if applied locally.

Copied from the link:
Hello,

scan-view-3.9 fails to find the needed python modules:

$ scan-view-3.9 scan-build-master/
Traceback (most recent call last):
  File "/usr/bin/scan-view-3.9", line 143, in <module>
    main()
  File "/usr/bin/scan-view-3.9", line 140, in main
    run(port, args, args.root)
  File "/usr/bin/scan-view-3.9", line 70, in run
    import ScanView
ImportError: No module named ScanView

the problem is that os.path.dirname(__file__) is /usr/bin and not
/usr/share/clang/scan-view-3.9/bin
as expected by the script.

A quick way to fix that is to hardcode the scan-view dir:

$ diff -u ../bin/scan-view.old ../bin/scan-view
--- ../bin/scan-view.old 2016-09-22 16:31:01.209052200 +0200
+++ ../bin/scan-view 2016-09-22 16:39:19.383579819 +0200
@@ -22,6 +22,8 @@
 kDefaultPort = 8181
 kMaxPortsToTry = 100

+BASE_DIR = '/usr/share/clang/scan-view-3.9'
+
 ###

@@ -61,7 +63,7 @@

 def run(port, options, root):
     # Prefer to look relative to the installed binary
- share = os.path.dirname(__file__) + "/../share/"
+ share = os.path.join(BASE_DIR, 'share')
     if not os.path.isdir(share):
         # Otherwise look relative to the source
         share = os.path.dirname(__file__) + "/../../scan-view/share"

Tags: patch
tags: added: patch
Changed in llvm-toolchain-3.9 (Debian):
status: Unknown → Fix Released
Revision history for this message
Kai Kratz (kkratz) wrote :

I retested this on 16.04 with clang-3.8 and there exists the same issue.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in llvm-toolchain-3.9 (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.