Skip to content

Conversation

@aborrero
Copy link
Contributor

@aborrero aborrero commented Dec 4, 2025

Instead of quoting externally the subshell call "$()", quote each find argument individually. This is because in certain scenarios, the shell executing find may expand some of the arguments if not quoted.

Previous to this patch, this pipeline instance:

- uses: test/tw/contains-files
  with:
    dir: "/etc/audit/rules.d/"
    name: "*.rules"
    type: "f"

May see the the * symbol interpreted by the shell, rather than by find, expanding into whatever is in the filesystem, and therefore breaking the find call, like this:

find /etc/audit/rules.d/ -name some.rules someother.rules -type f

With this patch, the same pipeline instance would execute the right find call:

find /etc/audit/rules.d/ -name '*.rules' -type f

Instead of quoting externally the subshell call "$()", quote each find argument
individually. This is because in certain scenarios, the shell executing find may
expand some of the arguments if not quoted.

Previous to this patch, this pipeline instance:

```
- uses: test/tw/contains-files
  with:
    dir: "/etc/audit/rules.d/"
    name: "*.rules"
    type: "f"
```

May see the the * symbol interpreted by the shell, rather than by find, expanding
into whatever is in the filesystem, and therefore breaking the find call, like this:

```
find /etc/audit/rules.d/ -name some.rules someother.rules -type f
```

With this patch, the same pipeline instance would execute the right find call:

```
find /etc/audit/rules.d/ -name '*.rules' -type f
```

Signed-off-by: Arturo Borrero Gonzalez <[email protected]>
Copy link
Contributor

@sergiodj sergiodj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! This is actually the correct way to do quoting when using $() :).

@aborrero aborrero merged commit 5ee3db7 into main Dec 4, 2025
8 checks passed
@aborrero aborrero deleted the arturo-575-pipelines-contains branch December 4, 2025 16:58
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.

3 participants