Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jul 2016 21:57:38 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 211448] sysrc(8): exit status on permission error
Message-ID:  <bug-211448-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D211448

            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@FreeBSD.org
          Reporter: me@cschwarz.com

When sysrc(8) encounters a permission error when changing a variable, it pr=
ints
an error message to stderr but exits with status 0.

This behavior is especially annoying in automation tools, as I had to encou=
nter
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 !=3D 0 to check if the sysrc(8) call succeeded.

Steps to reproduce:

 Login as unprivileged user.
 Run `sysrc sshd_enable=3DNO`.
 =3D> Exit code =3D 0
 =3D> Stderr: `sysrc: cannot create /etc/rc.conf: Permission denied\n`
 =3D> Stdour: <empty>

Expected:

 Exit code =3D 1

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-211448-8>