[Bug 256554] /usr/bin/id -c returns current users's login class, not specified user's

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 11 Jun 2021 16:32:58 +0000

            Bug ID: 256554
           Summary: /usr/bin/id -c returns current users's login class,
                    not specified user's
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: bugs_at_FreeBSD.org
          Reporter: asomers_at_FreeBSD.org

It's tempting to run "id -c somebody" to get somebody's login class.  Such an
invocation seems to work.  But it actually returns the login class of the
current user, not "somebody".  The man page and git history suggests that this
is the intended behavior.  However, I believe it is a bug to accept and ignore
a user argument.  Instead, id should return an error if a user is specified
along with "-c".

Steps to reproduce:
# Create a user with a non-default login class
> sudo pw useradd testy -L russian
# Try to lookup his login class.  It's wrong!
> id -c testy
# su to testy and lookup his current login class.  It's right.
> sudo su -m testy
% id -c

You are receiving this mail because:
You are the assignee for the bug.
Received on Fri Jun 11 2021 - 16:32:58 UTC

Original text of this message