[Bug 211448] sysrc(8): exit status on permission error
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Fri Jul 29 21:57:38 UTC 2016
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211448
Bug ID: 211448
Summary: sysrc(8): exit status on permission error
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Keywords: easy, needs-patch
Severity: Affects Some People
Priority: ---
Component: bin
Assignee: freebsd-bugs at FreeBSD.org
Reporter: me at cschwarz.com
When sysrc(8) encounters a permission error when changing a variable, it prints
an error message to stderr but exits with status 0.
This behavior is especially annoying in automation tools, as I had to encounter
recently (https://github.com/ansible/ansible-modules-core/pull/4283):
An unprivileged user will have to use heuristics and not rely on the exit
status being != 0 to check if the sysrc(8) call succeeded.
Steps to reproduce:
Login as unprivileged user.
Run `sysrc sshd_enable=NO`.
=> Exit code = 0
=> Stderr: `sysrc: cannot create /etc/rc.conf: Permission denied\n`
=> Stdour: <empty>
Expected:
Exit code = 1
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list