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

grep: fix command hanging forever when grep.{tool}-args is empty #681

Merged
merged 1 commit into from
Aug 31, 2023

Conversation

marc-hb
Copy link
Collaborator

@marc-hb marc-hb commented Aug 31, 2023

Fixes commit 1d220bb ("commands: add grep") / #678

Fix misplaced closing parenthese in:

shlex.split(self.config.get(f'grep.{tool}-args'), '')

The empty string is meant as a default value for config.get() but it was passed as a second argument to shlex.split() by mistake.

Funny enough this hangs forever:

>>> shlex.split(None, comments='')
<stdin>:1: DeprecationWarning: Passing None for 's' to shlex.split() is deprecated.
 (hangs forever)

PS: debuggers rulez

Fixes commit 1d220bb ("commands: add grep")

Fix misplaced closing parenthese in:

```
shlex.split(self.config.get(f'grep.{tool}-args'), '')
```

The empty string is meant as a default value for config.get() but it was
passed as a second argument to shlex.split() by mistake.

Funny enough this hangs forever:

```
>>> shlex.split(None, comments='')
<stdin>:1: DeprecationWarning: Passing None for 's' to shlex.split() is deprecated.
 (hangs forever)
```

PS: debuggers rulez

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@marc-hb marc-hb marked this pull request as ready for review August 31, 2023 17:30
@marc-hb marc-hb mentioned this pull request Aug 31, 2023
@mbolivar-ampere mbolivar-ampere merged commit 3e53dd5 into zephyrproject-rtos:main Aug 31, 2023
9 checks passed
@marc-hb marc-hb deleted the grep-hotfix branch August 31, 2023 22:03
@marc-hb
Copy link
Collaborator Author

marc-hb commented Aug 31, 2023

Because I have no grep.{tool}-args configuration, west grep was ALWAYS hanging for me! So I really wondered how the test was passing.

Mystery solved: that's because the (complex) tox+pytest test environment closes the standard input.

In fact a workaround for this bug is to hit Ctrl-D repeatedly; once for each git repo.

I can see that the test environment solves a lot of problems. But it also creates some distance and divergence with the real thing. I just tried to document this gap here:

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.

2 participants