[PATCH] D77880: get scan-view executable from environment

Oliver Tušla via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 10 08:53:31 PDT 2020


asmar created this revision.
asmar added a reviewer: NoQ.
Herald added subscribers: cfe-commits, Charusso.
Herald added a project: clang.

Fixes "Use of uninitialized value $ScanView in exec" error on systems with scan-view executable not located in the expected place.

Currently when scan-build is installed in Debian-like (Ubuntu 18.04 my case) system the scan-view executable is not correctly identified when installed by apt from clang-tools package.

The buggy code was first introduced here 10 ago:

https://bugs.llvm.org/show_bug.cgi?id=3725

The issue was recently reported on Debian Bugs:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=941614

The problem lies in current master scan-build:974:

https://github.com/llvm/llvm-project/blob/350522670232c74587138dc83161de514567f411/clang/tools/scan-build/bin/scan-build#L974

Searching for "$RealBin/../../scan-view/bin/scan-view" may not work in such cases because directories are versioned e.g. "$RealBin/../../scan-view-6.0/bin/scan-view".


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77880

Files:
  clang/tools/scan-build/bin/scan-build


Index: clang/tools/scan-build/bin/scan-build
===================================================================
--- clang/tools/scan-build/bin/scan-build
+++ clang/tools/scan-build/bin/scan-build
@@ -971,6 +971,7 @@
         my $ScanView = Cwd::realpath("$RealBin/scan-view");
         if (! -x $ScanView) { $ScanView = "scan-view"; }
         if (! -x $ScanView) { $ScanView = Cwd::realpath("$RealBin/../../scan-view/bin/scan-view"); }
+        if (! -x $ScanView) { $ScanView = `which scan-view`; chomp $ScanView; }
         exec $ScanView, "$Options{OutputDir}";
       }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77880.256580.patch
Type: text/x-patch
Size: 578 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200410/d7c4e324/attachment-0001.bin>


More information about the cfe-commits mailing list