Skip to content

Incorrect warning when scanning due to argument ordering in bash scripts #545

@webcoyote

Description

@webcoyote

When scanning a bash script opengrep incorrectly prints a warning if redirection-to-stderr appears first.

To Reproduce

MYTMPDIR="$(mktemp -d)"
cd "$MYTMPDIR"
echo "echo >&2 'test string'" > bad.sh
echo "echo 'test string' >&2" > good.sh
opengrep scan -v *.sh 2>&1 | grep WARN

Actual results

[WARN] Syntax error at line bad.sh:1

Expected behavior
No warnings should occur.

What is the priority of the bug to you?

  • P2: regular bug that should get fixed

Environment
Official binary
OSX Sequoia
opengrep 1.15.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions