Bug 238232 - [patch] sysrc ignores the -i ignore flag
Summary: [patch] sysrc ignores the -i ignore flag
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.0-STABLE
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-30 01:06 UTC by Yann Kerherve
Modified: 2024-09-28 01:05 UTC (History)
3 users (show)

See Also:


Attachments
simple patch to sysrc for -i (486 bytes, patch)
2019-05-30 01:06 UTC, Yann Kerherve
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yann Kerherve 2019-05-30 01:06:54 UTC
Created attachment 204709 [details]
simple patch to sysrc for -i

There is no functional difference between -q and -i.

The -i flag is documented as:

   Ignore unknown variables.

The -q flag is documented as:

   Quiet.  Disable verbose and hide certain errors.  When combined
   with ‘-L’ and one or more name arguments, provide only exit
   status and no output.


The current behavior is observed:

$ sysrc unknown
sysrc: unknown variable 'unknown'
$ echo $?
1
$ sysrc -q unknown
$ echo $?
1
$ sysrc -i unknown
$ echo $?
1


When the following behavior is expected:
$ sysrc -i unknown
sysrc: unknown variable 'unknown'
$ echo $?
0

Combining with the -q flag
$ sysrc -q -i unknown
$ echo $?
0

The following patch:
- Makes -i exit code 0
- Makes -i not suppress output unless combined with -q
Comment 1 Ed Maste freebsd_committer freebsd_triage 2019-06-05 14:39:13 UTC
dteske@ can you review?
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2024-09-28 00:49:34 UTC
^Triage: clear the now obsolete 'patch' keyword.

To submitter: is this aging PR still relevant?
Comment 3 Yann Kerherve 2024-09-28 01:05:37 UTC
I think it's still relevant, the alternative is to change the documentation but that's weird.