Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileNotFoundError: [Errno 2] No such file or directory: ‘NO FILE INFO YET’ #1817

Closed
securitygeneration opened this issue Oct 12, 2020 · 3 comments
Labels
alpha Relates to an experimental feature bug Something isn't working lang:c

Comments

@securitygeneration
Copy link

Describe the bug
Running r2c-security-audit on a C codebase results in FileNotFoundError: [Errno 2] No such file or directory: ‘NO FILE INFO YET’

Traceback (most recent call last):
  File "/usr/local/bin/semgrep", line 33, in <module>
    sys.exit(load_entry_point('semgrep==0.27.0', 'console_scripts', 'semgrep')())
  File "/usr/local/Cellar/semgrep/0.27.0/libexec/lib/python3.8/site-packages/semgrep/__main__.py", line 17, in main
    cli()
  File "/usr/local/Cellar/semgrep/0.27.0/libexec/lib/python3.8/site-packages/semgrep/cli.py", line 372, in cli
    semgrep.semgrep_main.main(
  File "/usr/local/Cellar/semgrep/0.27.0/libexec/lib/python3.8/site-packages/semgrep/semgrep_main.py", line 223, in main
    rule_matches_by_rule, debug_steps_by_rule, semgrep_errors, stats_line = CoreRunner(
  File "/usr/local/Cellar/semgrep/0.27.0/libexec/lib/python3.8/site-packages/semgrep/core_runner.py", line 523, in invoke_semgrep
    findings_by_rule, debug_steps_by_rule, errors, num_targets = self._run_rules(
  File "/usr/local/Cellar/semgrep/0.27.0/libexec/lib/python3.8/site-packages/semgrep/core_runner.py", line 491, in _run_rules
    rule_matches, debugging_steps, errors, rule_targets = self._run_rule(
  File "/usr/local/Cellar/semgrep/0.27.0/libexec/lib/python3.8/site-packages/semgrep/core_runner.py", line 394, in _run_rule
    errors.extend(
  File "/usr/local/Cellar/semgrep/0.27.0/libexec/lib/python3.8/site-packages/semgrep/core_runner.py", line 395, in <genexpr>
    CoreException.from_json(e, language, rule.id).into_semgrep_error()
  File "/usr/local/Cellar/semgrep/0.27.0/libexec/lib/python3.8/site-packages/semgrep/core_exception.py", line 80, in into_semgrep_error
    with open(self._path, errors="replace") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'NO FILE INFO YET'
semgrep --debug --config "https://semgrep.dev/p/r2c-security-audit" .
trying to download from https://semgrep.dev/p/r2c-security-audit
using config from https://semgrep.dev/p/r2c-security-audit. Visit https://semgrep.dev/registry to see all public rules.
downloading config...
loaded 1 configs in 4.777460098266602
running 214 rules from 1 config remote-url
running 214 rules...
Running rule c.lang.security.insecure-use-gets-fn.insecure-use-gets-fn...
type argument, maybe wrong typedef inference!
(Argument
   (ArgType
      ({ const = None; volatile = None },
       (TypeName (None, [], (IdIdent ("args1", ())))))))
type argument, maybe wrong typedef inference!
(Argument
   (ArgType
      ({ const = None; volatile = None },
       (Pointer ((),
          ({ const = None; volatile = None },
           (StructUnionName ((Struct, ()), ("rlp", ()))))
          )))))
[snip]

To Reproduce
As this is not open source code, I can't recommend a way to reproduce, but happy to help narrow things down.

Expected behavior
Semgrep to run normally

Screenshots
If applicable, add screenshots to help explain your problem.

Environment
If not using semgrep.dev: are you running off docker, an official binary, a local build?

Brew-installed macOS Catalina

@mschwager mschwager added the bug Something isn't working label Oct 12, 2020
@mschwager
Copy link
Contributor

Thanks for filing an issue @securitygeneration. We've see this NO FILE INFO YET error before:

@aryx do you know when and why this error occurs? It would be helpful if we added more debugging context around this error, like what file(s) are causing the error.

@aryx aryx added the lang:c label Oct 14, 2020
@nbrahms nbrahms added the alpha Relates to an experimental feature label Oct 15, 2020
@chu66yUnic0rn
Copy link

I have the same error caused by code:
myWindow = NewCWindow(nil, &wRect, "\pHello", true, zoomNoGrow, (WindowRef) -1, true, 0);
The issue is gone after removing \p

@mschwager
Copy link
Contributor

We're now gracefully handling this error case: #1999

This error either means Semgrep is running over invalid code, or there's a bug in our parsing. Either way, we shouldn't see NO FILE INFO YET anymore after the 0.31.0 release of Semgrep. I'm going to close this issue out, if you see lexical errors please open a new issue with the relevant pattern and code snippet. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alpha Relates to an experimental feature bug Something isn't working lang:c
Development

No branches or pull requests

5 participants