Skip to content

fix: report Homebrew failures, wait for the installer and resume the scan - #49

Open
Arthurvroum wants to merge 4 commits into
mainfrom
33-macos-ikos-install
Open

Arthurvroum wants to merge 4 commits into
mainfrom
33-macos-ikos-install

Conversation

@Arthurvroum

Copy link
Copy Markdown
Collaborator

On Apple Silicon, Homebrew refused an IKOS dependency until its tap was
trusted, but the installer hid the error, the command returned as soon as
the password terminal opened, and the next run asked to install again.

  • Homebrew runs as the invoking user, and a failed install is printed and
    summed up; the extension shows Homebrew's message, which says what to do.
  • The password terminal runs the installer itself; the extension waits for
    it to finish, verifies the tools, then the original scan resumes. A
    failed verification stops the run instead of opening another installer.
  • The script and its log go to a private temporary folder: a predictable
    name in /tmp could be replaced before sudo runs it.
  • The dependency check required /opt/homebrew/bin/cppcheck even when a
    suitable Cppcheck was installed elsewhere. The check and the analysis
    command now share one rule: the first SARIF-capable Cppcheck among
    Homebrew's, CoreTrace's tools folder and PATH.

Builds on #34.

Stacked on #48 (the fix for #34, itself on #47 and #46): merge those PRs first; this diff includes their commits.

Fixes #33

… on rejection

Paths with spaces are accepted since the validator checks option names
strictly and only rejects shell syntax in values. Two gaps remained:

- In the temporary-copy branch, the CLI was copied before the arguments
  were validated, so a rejected argument left the copy behind. They are
  now validated first, and temporary files are removed on any failure.
- Neither Windows branch was tested outside Windows. The calls to wsl.exe
  are now replaceable, so a report and a compile database under
  "C:\My Project" are checked to stay single arguments through the
  temporary-copy branch and through the branch that runs in the WSL
  distribution holding the source, on every platform.

Fixes #39
…e scan

With two WSL distributions, a source under \\wsl$\<non-default> runs in
that distribution, but the preflight and the installer always used the
default one: checking or repairing tools there gave the wrong answer.

- executionDistro() picks the distribution with the same rule as the
  command builder: the one of a WSL path when it is not the default,
  else the default (null). Ordinary Windows paths keep the default.
- The preflight checks the analyzers there, and its Install button
  installs them there. The sidebar's install button uses the
  distribution of the active file.

Builds on the replaceable wsl.exe calls of #39.

Fixes #40
When a selected tool cannot run, ctrace still writes the SARIF of the
others and exits 3. The extension announced a complete analysis, and the
incremental scan cached the partial report, so the file was never retried.
On WSL, the fallback script ended with its cleanup command, whose status
hid the CLI's.

- Exit 3 marks the file incomplete: its findings are shown, and the run
  ends with "Analysis incomplete", naming the tools that could not run
  from ctrace's output. Exit 2 (completed with findings) is unchanged.
- Only complete analyses are cached; an incomplete file is analysed again
  on the next scan. Cache entries written before this flag existed may be
  partial, so they are redone once.
- The WSL fallback script keeps ctrace's exit status after cleaning up.

Builds on the WSL command changes of #39 and #40.

Fixes #34
…scan

On Apple Silicon, Homebrew refused an IKOS dependency until its tap was
trusted, but the installer hid the error, the command returned as soon as
the password terminal opened, and the next run asked to install again.

- Homebrew runs as the invoking user, and a failed install is printed and
  summed up; the extension shows Homebrew's message, which says what to do.
- The password terminal runs the installer itself; the extension waits for
  it to finish, verifies the tools, then the original scan resumes. A
  failed verification stops the run instead of opening another installer.
- The script and its log go to a private temporary folder: a predictable
  name in /tmp could be replaced before sudo runs it.
- The dependency check required /opt/homebrew/bin/cppcheck even when a
  suitable Cppcheck was installed elsewhere. The check and the analysis
  command now share one rule: the first SARIF-capable Cppcheck among
  Homebrew's, CoreTrace's tools folder and PATH.

Builds on #34.

Fixes #33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS keeps prompting to install analyzers after Homebrew fails to install IKOS

1 participant