Bug - auto/unix incorrectly detects nobody group

In auto/unix (line 9 in 1.0.4) the pattern for detecting the nobody
group is not anchored properly and will incorrectly detect the group
nobody if the nobody user is in one of the listed groups. E.G. if
“nagcmd:x:114:nagios,nobody” appears in the file.

This is easily fixed by anchoring the grep regex to the beginning of the
line:

    if grep ^nobody /etc/group 2>&1 >/dev/null; then

Sean C.

Posted at Nginx Forum:

Hello!

On Tue, Jul 12, 2011 at 03:53:10PM -0400, scarley wrote:

In auto/unix (line 9 in 1.0.4) the pattern for detecting the nobody
group is not anchored properly and will incorrectly detect the group
nobody if the nobody user is in one of the listed groups. E.G. if
“nagcmd:x:114:nagios,nobody” appears in the file.

This is easily fixed by anchoring the grep regex to the beginning of the
line:

    if grep ^nobody /etc/group 2>&1 >/dev/null; then

Yes, thank you for report.

I wonder if it’s feasible to use “id -gn nobody” instead to find
out nobody’s group, it seems to be POSIX-complaint way to do this.
Quck test suggests that at least current FreeBSD, Linux and QNX
are able to handle this…

Maxim D.