uutils / procps

Rust reimplementation of the procps project
MIT License
18 stars 14 forks source link

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

Open cakebaker opened 3 months ago

cakebaker commented 3 months ago

The original pgrep shows an error message if the specified pattern is longer than 15 chars whereas our pgrep doesn't.

$ pgrep 123456789012345
$ pgrep 1234567890123456
pgrep: pattern that searches for process name longer than 15 characters will result in zero matches
Try `pgrep -f' option to match against the complete command line.

$ cargo run pgrep 123456789012345
$ cargo run pgrep 1234567890123456
Krysztal112233 commented 3 months ago

Does this need to be made compatible with GNU as well? Maybe it would be better to set an extra flag (such as --extended-pattern) as an extension of the uutils implementation?

cakebaker commented 3 months ago

Hm, it looks like this error only shows up if there is no match. If there is a match, there is no such error message:

$ pgrep pool_workqueue_release
3

So this means an extra flag doesn't make much sense.

It's a low-prio bug. I'm not sure whether we should fix it in our code or adapt the procps test suite accordingly when we run their test suite against our code.