Skip to content

Commit

Permalink
Fix crash in CPAchecker's tool-info module
Browse files Browse the repository at this point in the history
We have a heuristic that checks if CPAchecker is used from source
but misses a rebuild. This would crash if broken symlinks or other
file-access problems occur.
As it is just an optional feature, we can ignore such problems
and print a warning.

An example where this happened was for example
system-wide installation of CPAchecker
with the executable being /usr/bin/cpachecker
and /usr/src existing.
  • Loading branch information
PhilippWendler authored and EshaanAgg committed Jun 28, 2024
1 parent e44af7a commit 60611c1
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions benchexec/tools/cpachecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,21 @@ def executable(self, tool_locator):

# If this is a source checkout of CPAchecker, we heuristically check that
# sources are not newer than binaries (cpachecker.jar or files in bin/).
if os.path.isdir(src_dir):
src_mtime = self._find_newest_mtime(src_dir)

if os.path.isfile(jar_file):
if src_mtime > os.stat(jar_file).st_mtime:
sys.exit("CPAchecker JAR is not uptodate, run 'ant jar'!")

elif os.path.isdir(cls_dir):
if src_mtime > self._find_newest_mtime(cls_dir):
sys.exit("CPAchecker build is not uptodate, run 'ant'!")
try:
if os.path.isdir(src_dir):
src_mtime = self._find_newest_mtime(src_dir)

if os.path.isfile(jar_file):
if src_mtime > os.stat(jar_file).st_mtime:
sys.exit("CPAchecker JAR is not uptodate, run 'ant jar'!")

elif os.path.isdir(cls_dir):
if src_mtime > self._find_newest_mtime(cls_dir):
sys.exit("CPAchecker build is not uptodate, run 'ant'!")
except OSError as e:
logging.warning(
"Could not determine whether CPAchecker needs to be rebuilt: %s", e
)

return executable

Expand Down

0 comments on commit 60611c1

Please sign in to comment.