Bug 180381

Summary: pgrep(1): Cannot compile regular expression 'clang++'
Product: Base System Reporter: Slawomir Wojciech Wojtczak <vermaden>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed Not A Bug    
Severity: Affects Only Me CC: yuripv
Priority: Normal    
Version: 9.1-STABLE   
Hardware: Any   
OS: Any   

Description Slawomir Wojciech Wojtczak 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)

Regards,
vermaden

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

reclassify.
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 Slawomir Wojciech Wojtczak 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 freebsd_triage 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
     process.

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

$ pgrep -lf a\\+\\+
63750 ./a++
Comment 5 Slawomir Wojciech Wojtczak 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.

Regards.