Module Name: src Committed By: kre Date: Thu Aug 24 01:43:42 UTC 2017
Modified Files: src/usr.bin/sys_info: sys_info.1 sys_info.sh Log Message: Get rid of the arg sorting - it doesn't work properly, and makes it impossible to support component names containing embedded \n's (the similar embedded space problem would have been trivial to fix.) Deleting the sorting makes those issues moot, the args are no longer processed, hence can be anything. An alternative would be to sort the results - but that would separate the -v output from the real output (-v stuff is not rationally sortable) and also makes it much more difficult to get the error code for an unknown component (like one containing an embedded \n !) as the pipe to strt that would be used would cause the while loop to run in a sub-shell (effectively.) To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.bin/sys_info/sys_info.1 cvs rdiff -u -r1.11 -r1.12 src/usr.bin/sys_info/sys_info.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/sys_info/sys_info.1 diff -u src/usr.bin/sys_info/sys_info.1:1.3 src/usr.bin/sys_info/sys_info.1:1.4 --- src/usr.bin/sys_info/sys_info.1:1.3 Wed Aug 23 01:17:46 2017 +++ src/usr.bin/sys_info/sys_info.1 Thu Aug 24 01:43:42 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: sys_info.1,v 1.3 2017/08/23 01:17:46 kre Exp $ +.\" $NetBSD: sys_info.1,v 1.4 2017/08/24 01:43:42 kre Exp $ .\" .\" Copyright (c) 2016 Alistair Crooks <a...@netbsd.org> .\" All rights reserved. @@ -79,9 +79,6 @@ If no arguments are provided, then all o items that are known to .Nm are reported. -.Pp -If arguments are provided, the output is displayed in -alphabetical order, and duplicates are removed. .Sh EXIT STATUS .Nm exits with status 2 if an unknown option is given, @@ -103,5 +100,3 @@ The .Nm script was written by .An Alistair Crooks Aq Mt a...@netbsd.org . -.Sh BUGS -Component names containing spaces given as arguments do not work. Index: src/usr.bin/sys_info/sys_info.sh diff -u src/usr.bin/sys_info/sys_info.sh:1.11 src/usr.bin/sys_info/sys_info.sh:1.12 --- src/usr.bin/sys_info/sys_info.sh:1.11 Wed Aug 23 21:18:57 2017 +++ src/usr.bin/sys_info/sys_info.sh Thu Aug 24 01:43:42 2017 @@ -1,6 +1,6 @@ #! /bin/sh -# $NetBSD: sys_info.sh,v 1.11 2017/08/23 21:18:57 agc Exp $ +# $NetBSD: sys_info.sh,v 1.12 2017/08/24 01:43:42 kre Exp $ # Copyright (c) 2016 Alistair Crooks <a...@netbsd.org> # All rights reserved. @@ -26,7 +26,7 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -SYS_INFO_VERSION=20170823 +SYS_INFO_VERSION=20170824 PATH=$(sysctl -n user.cs_path) export PATH @@ -102,8 +102,7 @@ run() { getversion() { case "$1" in '') - # arriving here implies all==true, not possible otherwise - ;& + $all || return 0 ;& awk) run "awk --version | awk '{ print \$1 \"-\" \$3 }'" $all || return 0 ;& @@ -255,8 +254,6 @@ if [ $# -eq 0 ]; then set -- '' all=true else - # note this deletes any attempt to use '' as an arg. - set -- $( printf '%s\n' "$@" | sort -u ) all=false fi