[Bug 256554] /usr/bin/id -c returns current users's login class, not specified user's
Date: Fri, 11 Jun 2021 16:32:58 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256554
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@FreeBSD.org
Reporter: asomers@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
default
# su to testy and lookup his current login class. It's right.
> sudo su -m testy
% id -c
russian
--
You are receiving this mail because:
You are the assignee for the bug.