diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2020-02-26 12:31:36 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2020-02-26 12:31:36 +0000 |
commit | 5a729fe69e23102eef6f8e706f2b9ebe88059abf (patch) | |
tree | de1bd915d18d9708b4cdf8275508c6d8bb69512f | |
parent | 15928b62d653d40c29bbe08498913c3ac86e46d5 (diff) | |
parent | 2944b91ec59a95e39012331cb055e960ae6d4489 (diff) | |
download | illumos-joyent-5a729fe69e23102eef6f8e706f2b9ebe88059abf.tar.gz |
[illumos-gate merge]
commit 2944b91ec59a95e39012331cb055e960ae6d4489
12334 fix gcc4 build
12322 kdb: removal of unused dependency recommended
commit 13b136d3061155363c62c9f6568d25b8b27da8f6
12295 librsc: wrong argument for sizeof
commit f3a525d949e26238340eb8c1f6fdcfff91fc7e65
12328 FNMPERIOD makes little sense for find -path
Conflicts:
usr/src/test/util-tests/tests/Makefile
-rw-r--r-- | usr/src/Makefile.master | 2 | ||||
-rw-r--r-- | usr/src/cmd/find/find.c | 6 | ||||
-rw-r--r-- | usr/src/lib/krb5/plugins/kdb/ldap/Makefile.com | 2 | ||||
-rw-r--r-- | usr/src/lib/librsc/sparc/mpxu/common/librsc.c | 4 | ||||
-rw-r--r-- | usr/src/man/man1/find.1 | 20 | ||||
-rw-r--r-- | usr/src/pkg/manifests/system-test-utiltest.mf | 2 | ||||
-rw-r--r-- | usr/src/test/util-tests/tests/Makefile | 2 | ||||
-rw-r--r-- | usr/src/test/util-tests/tests/find/Makefile | 41 | ||||
-rw-r--r-- | usr/src/test/util-tests/tests/find/findtest.ksh | 72 |
9 files changed, 128 insertions, 23 deletions
diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master index ce6879be35..02242189d8 100644 --- a/usr/src/Makefile.master +++ b/usr/src/Makefile.master @@ -27,8 +27,8 @@ # Copyright 2015 Gary Mills # Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com> # Copyright 2016 Toomas Soome <tsoome@me.com> -# Copyright 2020 Joyent, Inc. # Copyright 2018 OmniOS Community Edition (OmniOSce) Association. +# Copyright 2020 Joyent, Inc. # Copyright 2019 RackTop Systems. # diff --git a/usr/src/cmd/find/find.c b/usr/src/cmd/find/find.c index 5b5811ea6a..8860e9b711 100644 --- a/usr/src/cmd/find/find.c +++ b/usr/src/cmd/find/find.c @@ -22,6 +22,7 @@ * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2012 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 Andrew Stormont. All rights reserved. + * Copyright 2020 Joyent, Inc. */ @@ -1027,9 +1028,12 @@ execute(const char *name, const struct stat *statb, int type, struct FTW *state) * /usr/bin/find will not pattern match a leading * '.' in a filename, unless '.' is explicitly * specified. + * + * The legacy behavior makes no sense for PATH. */ #ifndef XPG4 - fnmflags |= FNM_PERIOD; + if (np->action == NAME || np->action == INAME) + fnmflags |= FNM_PERIOD; #endif val = !fnmatch(np->first.cp, diff --git a/usr/src/lib/krb5/plugins/kdb/ldap/Makefile.com b/usr/src/lib/krb5/plugins/kdb/ldap/Makefile.com index a5e79c04ca..966241305e 100644 --- a/usr/src/lib/krb5/plugins/kdb/ldap/Makefile.com +++ b/usr/src/lib/krb5/plugins/kdb/ldap/Makefile.com @@ -47,7 +47,7 @@ include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5 #override liblink INS.liblink= -$(RM) $@; $(SYMLINK) $(LIBLINKS)$(VERS) $@ -CPPFLAGS += -DHAVE_CONFIG_H \ +CPPFLAGS += -DHAVE_CONFIG_H \ -I$(SRC)/cmd/krb5/iprop \ -I$(SRC)/lib/krb5 \ -I$(SRC)/lib/krb5/kdb \ diff --git a/usr/src/lib/librsc/sparc/mpxu/common/librsc.c b/usr/src/lib/librsc/sparc/mpxu/common/librsc.c index 863c304fcc..c39719f473 100644 --- a/usr/src/lib/librsc/sparc/mpxu/common/librsc.c +++ b/usr/src/lib/librsc/sparc/mpxu/common/librsc.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * ENXS platform-specific functions */ @@ -151,7 +149,7 @@ rscp_init(void) /* * 'erase' the rx buffer */ - (void) memset(rsc_rx_buffer, 0, sizeof (RSC_MAX_RX_BUFFER)); + (void) memset(rsc_rx_buffer, 0, sizeof (rsc_rx_buffer)); rsc_rx_resp_len = 0; rsc_rx_error = 0; rsc_rx_resp_type = DP_NULL_MSG; diff --git a/usr/src/man/man1/find.1 b/usr/src/man/man1/find.1 index 47f3870d12..d393a3197d 100644 --- a/usr/src/man/man1/find.1 +++ b/usr/src/man/man1/find.1 @@ -45,12 +45,12 @@ .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved .\" Copyright 2011 Nexenta Systems, Inc. All rights reserved. .\" Copyright (c) 2013 Andrew Stormont. All rights reserved. +.\" Copyright 2020 Joyent, Inc. .\" -.TH FIND 1 "Sep 5, 2011" +.TH FIND 1 "Feb 20, 2020" .SH NAME find \- find files .SH SYNOPSIS -.LP .nf \fB/usr/bin/find\fR [\fB-E\fR] [\fB-H\fR | \fB-L\fR] \fIpath\fR... \fIexpression\fR .fi @@ -61,7 +61,6 @@ find \- find files .fi .SH DESCRIPTION -.LP The \fBfind\fR utility recursively descends the directory hierarchy for each \fIpath\fR seeking files that match a Boolean \fIexpression\fR written in the primaries specified below. @@ -75,7 +74,6 @@ by the application exceeds \fIPATH_MAX\fR requirements). \fBfind\fR detects infinite loops; that is, entering a previously visited directory that is an ancestor of the last file encountered. .SH OPTIONS -.LP The following options are supported: .sp .ne 2 @@ -117,7 +115,6 @@ Specifying more than one of the mutually-exclusive options \fB-H\fR and \fB-L\fR is not considered an error. The last option specified determines the behavior of the utility. .SH OPERANDS -.LP The following operands are supported: .sp .ne 2 @@ -169,7 +166,6 @@ less than \fIn\fR .RE .SS "Expressions" -.LP Valid expressions are: .sp .ne 2 @@ -549,7 +545,8 @@ question mark first, and is executed only if the response is affirmative. \fB\fB-path\fR\fR .ad .RS 17n -Like \fB-name\fR, but matches the entire file path and not just basename. +Like \fB-name\fR, but matches the entire file path and not just basename, and +without any special treatment of leading periods. .RE .sp @@ -717,7 +714,6 @@ True if the file has extended attributes. .RE .SS "Complex Expressions" -.LP The primaries can be combined using the following operators (in order of decreasing precedence): .sp @@ -783,11 +779,9 @@ The \fB-user\fR, \fB-group\fR, and \fB-newer\fR primaries each evaluate their respective arguments only once. Invocation of \fIcommand\fR specified by \fB-exec\fR or \fB-ok\fR does not affect subsequent primaries on the same file. .SH USAGE -.LP See \fBlargefile\fR(5) for the description of the behavior of \fBfind\fR when encountering files greater than or equal to 2 Gbyte (2^31 bytes). .SH EXAMPLES -.LP \fBExample 1 \fRWriting Out the Hierarchy Directory .sp .LP @@ -957,7 +951,6 @@ example% \fBfind . -xattr\fR .sp .SH ENVIRONMENT VARIABLES -.LP See \fBenviron\fR(5) for descriptions of the following environment variables that affect the execution of \fBfind\fR: \fBLANG\fR, \fBLC_ALL\fR, \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR. @@ -982,7 +975,6 @@ in \fBLC_CTYPE\fR determines the locale for interpretation of sequences of bytes of text data a characters, the behavior of character classes used in the expression defined for the \fByesexpr\fR. See \fBlocale\fR(5). .SH EXIT STATUS -.LP The following exit values are returned: .sp .ne 2 @@ -1030,7 +1022,6 @@ File that registers distributed file system packages .RE .SH ATTRIBUTES -.LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -1049,13 +1040,11 @@ Standard See \fBstandards\fR(5). .TE .SH SEE ALSO -.LP \fBchmod\fR(1), \fBcpio\fR(1), \fBsh\fR(1), \fBtest\fR(1), \fBls\fR(1B), \fBacl\fR(5), \fBregex\fR(5), \fBstat\fR(2), \fBumask\fR(2), \fBattributes\fR(5), \fBenviron\fR(5), \fBfsattr\fR(5), \fBlargefile\fR(5), \fBlocale\fR(5), \fBstandards\fR(5) .SH WARNINGS -.LP The following options are obsolete and will not be supported in future releases: .sp @@ -1079,7 +1068,6 @@ format (5120-byte records). .RE .SH NOTES -.LP When using \fBfind\fR to determine files modified within a range of time, use the \fB-mtime\fR argument \fBbefore\fR the \fB-print\fR argument. Otherwise, \fBfind\fR gives all files. diff --git a/usr/src/pkg/manifests/system-test-utiltest.mf b/usr/src/pkg/manifests/system-test-utiltest.mf index 5a5502a28b..72aaf86076 100644 --- a/usr/src/pkg/manifests/system-test-utiltest.mf +++ b/usr/src/pkg/manifests/system-test-utiltest.mf @@ -56,6 +56,7 @@ dir path=opt/util-tests/tests/files/make_a/a dir path=opt/util-tests/tests/files/make_a/b dir path=opt/util-tests/tests/files/make_a/c dir path=opt/util-tests/tests/files/make_l +dir path=opt/util-tests/tests/find dir path=opt/util-tests/tests/libcustr dir path=opt/util-tests/tests/libnvpair_json dir path=opt/util-tests/tests/libsff @@ -1432,6 +1433,7 @@ file path=opt/util-tests/tests/files/test5 mode=0444 file path=opt/util-tests/tests/files/test6 mode=0444 file path=opt/util-tests/tests/files/test7 mode=0444 file path=opt/util-tests/tests/files/testnl mode=0444 +file path=opt/util-tests/tests/find/findtest mode=0555 file path=opt/util-tests/tests/grep_test mode=0555 file path=opt/util-tests/tests/iconv_test mode=0555 file path=opt/util-tests/tests/libcustr/custr_remove mode=0555 diff --git a/usr/src/test/util-tests/tests/Makefile b/usr/src/test/util-tests/tests/Makefile index 67efd10530..df0f7a7709 100644 --- a/usr/src/test/util-tests/tests/Makefile +++ b/usr/src/test/util-tests/tests/Makefile @@ -20,6 +20,6 @@ SUBDIRS = date dis dladm iconv libnvpair_json libsff printf xargs grep_xpg4 SUBDIRS += demangle mergeq workq chown ctf smbios libjedec awk make sleep -SUBDIRS += bunyan libcustr +SUBDIRS += bunyan libcustr find include $(SRC)/test/Makefile.com diff --git a/usr/src/test/util-tests/tests/find/Makefile b/usr/src/test/util-tests/tests/find/Makefile new file mode 100644 index 0000000000..66e2bab009 --- /dev/null +++ b/usr/src/test/util-tests/tests/find/Makefile @@ -0,0 +1,41 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2020 Joyent, Inc. +# + +include $(SRC)/cmd/Makefile.cmd +include $(SRC)/test/Makefile.com + +ROOTOPTPKG = $(ROOT)/opt/util-tests/tests/find +PROG = findtest + +ROOTPROG = $(PROG:%=$(ROOTOPTPKG)/%) + +all: + +install: $(ROOTPROG) + +clobber: clean + +clean: + +$(CMDS): $(TESTDIR) + +$(ROOTOPTPKG): + $(INS.dir) + +$(ROOTOPTPKG)/%: %.ksh $(ROOTOPTPKG) + $(INS.rename) + +$(ROOTOPTPKG)/%: % $(ROOTOPTPKG) + $(INS.file) diff --git a/usr/src/test/util-tests/tests/find/findtest.ksh b/usr/src/test/util-tests/tests/find/findtest.ksh new file mode 100644 index 0000000000..9e321fb664 --- /dev/null +++ b/usr/src/test/util-tests/tests/find/findtest.ksh @@ -0,0 +1,72 @@ +#!/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2020 Joyent, Inc. +# + +# +# Clearly, grossly incomplete. +# + +export LC_ALL=C.UTF-8 + +set -o pipefail +unalias -a + +find_prog=/usr/bin/find +find_prog_xpg4=/usr/xpg4/bin/find +find_dir="$(mktemp -d -p /tmp/)" +find_exit=0 + +testfind() +{ + exp=$1 + shift + cmd="$@" + + echo "TEST: $cmd" + + out=$(eval $cmd | tr '\n' ',') + + [[ "$exp" = "$out" ]] || { + echo "TEST FAILED: $cmd" >&2 + echo "expected: $exp" >&2 + echo "got: $out" >&2 + find_exit=1 + } +} + +mkdir -p $find_dir/1 +mkdir -p $find_dir/.2 +touch $find_dir/.2/1 +touch $find_dir/.2/c + +testfind "$find_dir/1,$find_dir/.2/1," \ + $find_prog $find_dir -name \"1\" +testfind "$find_dir/1,$find_dir/.2/1," \ + $find_prog $find_dir -path \"*1\" + +cd $find_dir + +testfind "" $find_prog . -name \"*2\" +testfind "./.2," $find_prog_xpg4 . -name \"*2\" +testfind "./.2," $find_prog . -name \".*2\" +testfind "./.2," $find_prog_xpg4 . -name \".*2\" +testfind "./1,./.2/1," $find_prog . -path \"*1\" +testfind "./.2," $find_prog . -path \"*2\" +testfind "./.2,./.2/1,./.2/c," $find_prog . -path \"*2*\" + +cd - +rm -rf $find_dir + +exit $find_exit |