Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Oct 2018 18:39:11 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 232657] usr.sbin/sysrc: Return code 0 after failing to modify a file
Message-ID:  <bug-232657-227@https.bugs.freebsd.org/bugzilla/>

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

            Bug ID: 232657
           Summary: usr.sbin/sysrc: Return code 0 after failing to modify
                    a file
           Product: Base System
           Version: 11.2-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: kwiat3k@panic.pl

To reproduce try to modify file in non existing directory:
$ sysrc -f ./nonexistent/testfile foo=3D"bar"
/usr/sbin/sysrc: cannot create ./nonexistent/testfile: No such file or
directory
$ echo $?
0

The exit code is 0 while I was expecting to see ENOENT (2).

It's the same when I try to modify file that is not accessible:
$ sysrc -f /etc/rc.conf foo=3Dbar
/usr/sbin/sysrc: cannot create /etc/rc.conf: Permission denied
$ echo $?
0

In this case EACCESS (13) should be returned.

I don't think that distinguishing these errors is needed. Returning anything
different than 0 should do the job.

--=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-232657-227>