Skip to content

Conversation

@Franklin-Qi
Copy link
Contributor

The PIDs should be obtained in advance. If the PIDs exist, it means the pattern matches, and there should be no length error.

Closes: #121

@Franklin-Qi Franklin-Qi closed this Feb 4, 2026
@Franklin-Qi Franklin-Qi reopened this Feb 4, 2026
@dezgeg
Copy link
Contributor

dezgeg commented Feb 5, 2026

Would be better to add the check to find_matching_pids (I think), calling collect_matched_pids() will essentially halve performance of the program

@Franklin-Qi
Copy link
Contributor Author

Franklin-Qi commented Feb 5, 2026

Would be better to add the check to find_matching_pids (I think), calling collect_matched_pids() will essentially halve performance of the program

@dezgeg Thanks for the feedback. Calling the collect_matched_pids function twice does indeed impact performance. Moving the length error information to the subsequent find_matching_pids might be a better idea.

@Franklin-Qi Franklin-Qi force-pushed the bugfix-#121-long-length-pattern-matching-pids-is-avaiable branch 2 times, most recently from aadf322 to 872c3cc Compare February 5, 2026 07:27
…e able to match pid correctly.

The PIDs should be obtained in advance. If the PIDs exist, it means the pattern matches, and there should be no length error.
@Franklin-Qi Franklin-Qi force-pushed the bugfix-#121-long-length-pattern-matching-pids-is-avaiable branch from 872c3cc to 54fbe8c Compare February 6, 2026 08:39
@cakebaker cakebaker merged commit 64be323 into uutils:main Feb 9, 2026
16 checks passed
@cakebaker
Copy link
Contributor

Thanks for your PR!

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (7b77e2f) to head (54fbe8c).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff     @@
##   main   #617   +/-   ##
===========================
===========================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

let mut pids = collect_matched_pids(settings)?;

if pids.is_empty() {
if !settings.full && settings.regex.as_str().len() > 15 {
Copy link
Contributor

Choose a reason for hiding this comment

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

I now noticed there's a pre-existing bug - if -x is used the length check is off by two characters (due to added ^$) - ie. cargo run pgrep -x 12345678901234 will trigger the message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dezgeg Yeah, I tested this issue, and it did exist before. Perhaps we can raise an new issue about it, and I will resolve it later.

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.

pgrep: should show an error message if pattern is longer than 15 chars and there's no match

3 participants