Bug#909662: Please consider backporting upstream commit rC343105 for scan-build
Roman Lebedev
lebedev.ri at gmail.com
Wed Sep 26 14:25:35 BST 2018
Package: clang-tools-7
Version: 1:7-2
Severity: wishlist
Tags: upstream patch
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Upstream commit https://reviews.llvm.org/rC343105 addressed a defect
of scan-build script, which was ignoring the exit status of the actual
build when the script was told to exit if the static analysis detected
bugs, and no bugs were detected.
Since i'm using these LLVM stable packages from debian testing in CI,
this issue is somewhat cripplig (e.g. when the build itself is also
using clang-tidy, so it's errors will be silently discarded..)
I have requested for this commit to be backported into the 7.0.1 proper,
but that will take a while.
Please consider backporting/applying this patch for the LLVM 7 package.
Maybe for LLVM 6 too.
Roman.
- -- System Information:
Debian Release: buster/sid
APT prefers unstable
APT policy: (990, 'unstable'), (500, 'unstable-debug'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 4.18.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages clang-tools-7 depends on:
ii clang-7 1:7-2
ii libc6 2.27-6
ii libclang1-7 1:7-2
ii libgcc1 1:8.2.0-7
ii libllvm7 1:7-2
ii libstdc++6 8.2.0-7
clang-tools-7 recommends no packages.
clang-tools-7 suggests no packages.
- -- no debconf information
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCgAdFiEEjkF6151RK40WXe2HCDw+u0oWieAFAluriM8ACgkQCDw+u0oW
ieCP/w//e7UuhUlhdtKIlutqBrW/zzehSnL8gygsImnKHRO/JLj0Yz/rSfz1InDJ
X/ZjuHaN+/tuO/e8GjgGSUoxzfhpK2ab+cLmU8F1OSCC1CASxpgndTMXKfohrKu5
OxuLv8hpRwFp1w6YGpYacNGAkXihzPMJ0BJ7UxNvkwDo08BUO+Z9goch22xjMrTu
pros8ywRJNMQpZE/01qPxkxksgSC0WOIMJwXuv0DiEtmz5/OLMJRZbxsuXzXHSmU
SGxvhytEa31RHxGt584X+jCmztnVXf4W0Ql3oaINqGdQJc7pdcb3jpm4o778zWXR
ueYZWmKucyXTGenr/t4mWER/6mnoXr6AILpDZ9MBoQfDWAWjYqzgqtXHjfV9NJUh
HxR/zMkdHrlyyzOxOmEqnyl+YzB2p6tA13ohkGSSQUiiMpHm/bPzmhdIgPFYbUvR
GBeYTWeMfi85jMg9PzAGNjp9lX9+xSIV7dyaflXgA/O6zG2CPyMmBdtK0KOVFz0C
hUQRizAM3awPrquPAz5wn029YbI4ivecw0sXpicBNMPUpmElPDkUXFsoj3x1kVMT
va5PHg/SWIoTyK9ZJrahGCtwZDOwunSlkY2mN1PgdheNXGQjovgVPhzpnCvQY2Av
UwPF3Y3n5ylauBriRIEmYbCPBxbn0XQWsE4NGdIzbVjOJGi/8uc=
=7ijn
-----END PGP SIGNATURE-----
-------------- next part --------------
>From 564f50e7536dab9dec5ed73f811b0b2d9d3aed14 Mon Sep 17 00:00:00 2001
From: Roman Lebedev <lebedev.ri at gmail.com>
Date: Wed, 26 Sep 2018 13:08:44 +0000
Subject: [PATCH] [analyzer] scan-build: if --status-bugs is passed, don't
forget about the exit status of the actual build
Summary:
This has been bothering me for a while, but only now i have actually looked into this.
I'm using one CI job for static analysis - clang static analyzers as compilers + clang-tidy via cmake.
And i'd like for the build to fail if at least one of those finds issues.
If clang-tidy finds issues, it will fail the build since the warnings-as-errors is set.
If static analyzer finds anything, since --status-bugs is set, it will fail the build.
But if clang-tidy find anything, but static analyzer does not, the build succeeds :/
Reviewers: sylvestre.ledru, alexfh, jroelofs, ygribov, george.karpenkov, krememek
Reviewed By: jroelofs
Subscribers: xazax.hun, szepet, a.sidorin, mikhail.ramalho, Szelethus, cfe-commits
Differential Revision: https://reviews.llvm.org/D52530
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343105 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/scan-build/bin/scan-build b/tools/scan-build/bin/scan-build
index 5500421c8c..25aeb2bf64 100755
--- a/tools/scan-build/bin/scan-build
+++ b/tools/scan-build/bin/scan-build
@@ -1202,17 +1202,17 @@ OPTIONS:
By default the output of scan-build is a set of HTML files. This option
outputs the results as a set of HTML and .plist files.
--status-bugs
By default, the exit status of scan-build is the same as the executed build
command. Specifying this option causes the exit status of scan-build to be 1
- if it found potential bugs and 0 otherwise.
+ if it found potential bugs and the exit status of the build itself otherwise.
--exclude <path>
Do not run static analyzer against files found in this
directory (You can specify this option multiple times).
Could be useful when project contains 3rd party libraries.
--use-cc [compiler path]
@@ -1903,14 +1903,14 @@ if (defined $Options{OutputFormat}) {
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"); }
exec $ScanView, "$Options{OutputDir}";
}
if ($Options{ExitStatusFoundBugs}) {
exit 1 if ($NumBugs > 0);
- exit 0;
+ exit $ExitStatus;
}
}
}
exit $ExitStatus;
--
2.19.0
More information about the Pkg-llvm-team
mailing list