| Summary: | usr.sbin/sysrc: Warning message "unknown variable" should be on stderr | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Andreas Sommer <andreas.sommer87> | ||||
| Component: | bin | Assignee: | Devin Teske <dteske> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | CC: | dteske | ||||
| Priority: | --- | Keywords: | patch | ||||
| Version: | 11.1-RELEASE | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
Thanks. Will apply with minor modification -- \\n should be \n (doesn't matter if the shell expands it before passing it to printf or not; either way you get the desired result). A commit references this bug: Author: dteske Date: Mon Jul 16 18:53:18 UTC 2018 New revision: 336350 URL: https://svnweb.freebsd.org/changeset/base/336350 Log: sysrc(8): Send error message to stderr (not stdout) PR: bin/229806 Reported by: Andreas Sommer <andreas.sommer87@googlemail.com> MFC after: 3 days X-MFC-to: stable/11 stable/10 stable/9 Sponsored by: Smule, Inc. Changes: head/usr.sbin/sysrc/sysrc (In reply to Devin Teske from comment #1) Sure, I don't mind staying consistent in "\n" vs. "\\n" as it does not matter here. Linters like shellcheck, however, explicitly spit out a note at such lines (which is why I usually write it using escaping): Backslash is literal in "\n". Prefer explicit escaping: "\\n". [SC1117] A commit references this bug: Author: dteske Date: Fri Aug 10 20:08:00 UTC 2018 New revision: 337588 URL: https://svnweb.freebsd.org/changeset/base/337588 Log: MFC SVN r336350: Send sysrc(8) error message to stderr (not stdout) PR: bin/229806 Reported by: Andreas Sommer <andreas.sommer87@googlemail.com> Sponsored by: Smule, Inc. Changes: _U stable/10/ stable/10/usr.sbin/sysrc/sysrc _U stable/11/ stable/11/usr.sbin/sysrc/sysrc _U stable/9/ _U stable/9/usr.sbin/ _U stable/9/usr.sbin/sysrc/ stable/9/usr.sbin/sysrc/sysrc |
Created attachment 195172 [details] Write warning to stderr Patch speaks for itself. This hit me when I did a scripted `sysrc -n -f /usr/local/etc/my-config-file my-var` and ended up having an error message in stdout instead of an empty value.