Skip to content

test: incorrectly parses unary operators when followed by a string comparison operator #9950

@ChrisDryden

Description

@ChrisDryden

Example:

test -f = a -o b

GNU Result:

exit 0

uutils behaviour:

"extra argument 'a'" → exit 2

This example comes from the busybox test suite in the "test -f = a -o b: should be true (0)" test.

Solution:

When parsing a unary operator, look ahead to see if its a string comparison operator that has another argument. This would be in the parser.rs file in the term function. This should require only a few lines of code change and a regression test so it would be best to leave to a new contributor.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions