Actually, I noted that things are even more weird:
The first 0x0 should likely act as a string terminator anyway... so the matched
string shouldn't see any trailing newlines.
But even even these non-anchored patterns don't match:
$ pgrep --full --exact --euid "${LOGNAME}" --list-full -- "^ssh:
${HOME}/\.ssh/mux/.+ \[mux]"
$ pgrep --full --exact --euid "${LOGNAME}" --list-full -- "^ssh:
${HOME}/\.ssh/mux/.+ \["
$ pgrep --full --exact --euid "${LOGNAME}" --list-full -- "^ssh:
${HOME}/\.ssh/mux/.+ .m"
$ pgrep --full --exact --euid "${LOGNAME}" --list-full -- "^ssh:
${HOME}/\.ssh/mux/.+ .m."
$ pgrep --full --exact --euid "${LOGNAME}" --list-full -- "^ssh:
${HOME}/\.ssh/mux/.+ .m.."
Interestingly though, this matches:
$ pgrep --full --exact --euid "${LOGNAME}" --list-full -- "^ssh:
${HOME}/\.ssh/mux/.+ ."
34724 ssh: /home/calestyo/.ssh/mux/[email protected]:22 [mux]
And trying grep itself:
$ grep -E "^ssh: ${HOME}/\.ssh/mux/.+ \[mux]$" /proc/34724/cmdline
grep: /proc/34724/cmdline: binary file matches
$ grep -E "^ssh: ${HOME}/\.ssh/mux/.+ \[mux]" /proc/34724/cmdline
grep: /proc/34724/cmdline: binary file matches
and with text mode:
$ grep -aE "^ssh: ${HOME}/\.ssh/mux/.+ \[mux]$" /proc/34724/cmdline
$ grep -aE "^ssh: ${HOME}/\.ssh/mux/.+ \[mux]" /proc/34724/cmdline
ssh: /home/calestyo/.ssh/mux/[email protected]:22 [mux]
Since I'm actually pretty sure that my script used to work before...
maybe the bug/change was somewhere else? Perhaps glibc?
Cheers,
Chris.