Bug 180381 - pgrep(1): Cannot compile regular expression 'clang++'
Summary: pgrep(1): Cannot compile regular expression 'clang++'
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 9.1-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
Depends on:
Reported: 2013-07-08 13:00 UTC by vermaden
Modified: 2019-09-17 11:57 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description vermaden 2013-07-08 13:00:00 UTC
The 'pgrep' is not able to find processes with '+' in name, is that desired behaviur?

% pgrep clang++
pgrep: Cannot compile regular expression `clang++' (repetition-operator operand invalid)


How-To-Repeat: % pgrep clang++
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2013-07-15 16:48:06 UTC
Responsible Changed
From-To: freebsd-amd64->freebsd-bugs

Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:46 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 3 vermaden 2019-07-16 11:35:18 UTC
Same on latest 11.3-RELEASE.

% pgrep clang++
pgrep: Cannot compile regular expression `clang++' (repetition-operator operand invalid)
Comment 4 Yuri Pankov freebsd_committer 2019-09-16 22:21:17 UTC
Yes, that is expected behavior, from pgrep(1) man page:

     If any pattern operands are specified, they are used as extended regular
     expressions to match the command name or full argument list of each

You'll have to escape all characters that have special meaning in regular expressions, e.g.:

$ pgrep -lf a\\+\\+
63750 ./a++
Comment 5 vermaden 2019-09-17 11:57:42 UTC
(In reply to Yuri Pankov from comment #4)

Pity but at least its documented.

Thank You for Your reply.