summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Pyhalov <apyhalov@gmail.com>2019-02-28 07:18:22 +0000
committerJoshua M. Clulow <jmc@joyent.com>2019-02-28 15:20:13 +0000
commitb0c7067b0f7269cbe7a7836f3ef5974c8b0e7e75 (patch)
treebb40d70cdf10dc812c86b98f777703f0d4920ca2
parent5e31a4cb257e79aefd738be870b78afe473dfe63 (diff)
downloadillumos-joyent-jclulow_10417.tar.gz
10417 recursive chown should not traverse any symbolic links by defaultjclulow_10417
Reviewed by: Andy Fiddaman <andy@omniosce.org> Reviewed by: Peter Tribble <peter.tribble@gmail.com>
-rw-r--r--usr/src/cmd/chgrp/Makefile28
-rw-r--r--usr/src/cmd/chgrp/chgrp.c32
-rw-r--r--usr/src/cmd/chown/Makefile29
-rw-r--r--usr/src/cmd/chown/chown.c34
-rw-r--r--usr/src/cmd/ksh/builtins/alias.c6
-rw-r--r--usr/src/lib/libshell/common/data/solaris_cmdlist.h2
-rw-r--r--usr/src/man/man1/chgrp.176
-rw-r--r--usr/src/man/man1/chown.1326
-rw-r--r--usr/src/pkg/manifests/system-test-utiltest.mf13
-rw-r--r--usr/src/pkg/manifests/system-xopen-xcu4.mf4
-rw-r--r--usr/src/test/util-tests/runfiles/default.run1
-rw-r--r--usr/src/test/util-tests/tests/Makefile2
-rw-r--r--usr/src/test/util-tests/tests/chown/Makefile45
-rw-r--r--usr/src/test/util-tests/tests/chown/chown_test.ksh103
-rw-r--r--usr/src/test/util-tests/tests/chown/files/Makefile50
-rw-r--r--usr/src/test/util-tests/tests/chown/files/cout010
-rw-r--r--usr/src/test/util-tests/tests/chown/files/cout110
-rw-r--r--usr/src/test/util-tests/tests/chown/files/cout1010
-rw-r--r--usr/src/test/util-tests/tests/chown/files/cout1110
-rw-r--r--usr/src/test/util-tests/tests/chown/files/cout120
-rw-r--r--usr/src/test/util-tests/tests/chown/files/cout210
-rw-r--r--usr/src/test/util-tests/tests/chown/files/cout310
-rw-r--r--usr/src/test/util-tests/tests/chown/files/cout410
-rw-r--r--usr/src/test/util-tests/tests/chown/files/cout510
-rw-r--r--usr/src/test/util-tests/tests/chown/files/cout610
-rw-r--r--usr/src/test/util-tests/tests/chown/files/cout710
-rw-r--r--usr/src/test/util-tests/tests/chown/files/cout810
-rw-r--r--usr/src/test/util-tests/tests/chown/files/cout910
28 files changed, 405 insertions, 466 deletions
diff --git a/usr/src/cmd/chgrp/Makefile b/usr/src/cmd/chgrp/Makefile
index cac25266b7..7de84a25df 100644
--- a/usr/src/cmd/chgrp/Makefile
+++ b/usr/src/cmd/chgrp/Makefile
@@ -19,49 +19,37 @@
# CDDL HEADER END
#
#
-#ident "%Z%%M% %I% %E% SMI"
-#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
PROG= chgrp
-XPG4PROG= chgrp
-XD= exobjs.xpg4
EXOBJS= chgrp.o
-XPG4EXOBJS= exobjs.xpg4/chgrp.o
include ../Makefile.cmd
-$(XPG4) := CFLAGS += -DXPG4
+ROOTXPG4LINK=$(ROOTXPG4BIN)/$(PROG)
+
CPPFLAGS += -D_FILE_OFFSET_BITS=64
LDLIBS += -lcmdutils -lsec
.KEEP_STATE:
-all: $(PROG) $(XPG4)
+all: $(PROG)
$(PROG): $(EXOBJS)
$(LINK.c) -o $@ $(EXOBJS) $(LDLIBS)
$(POST_PROCESS)
-$(XPG4): $(XD) $(XPG4EXOBJS)
- $(LINK.c) -o $@ $(XPG4EXOBJS) $(LDLIBS)
- $(POST_PROCESS)
+$(ROOTXPG4LINK): $(ROOTPROG)
+ -$(RM) $@
+ -$(SYMLINK) ../../bin/chgrp $@
-install: all $(ROOTPROG) $(ROOTXPG4PROG)
+install: all $(ROOTPROG) $(ROOTXPG4LINK)
clean:
- -@rm -rf $(EXOBJS) $(XD)
+ -@rm -rf $(EXOBJS)
lint: lint_PROG
-$(XPG4EXOBJS): $(XD)
-
-$(XD)/%.o: %.c
- $(COMPILE.c) -o $@ $<
-
-$(XD):
- -@mkdir -p $@
-
include ../Makefile.targ
diff --git a/usr/src/cmd/chgrp/chgrp.c b/usr/src/cmd/chgrp/chgrp.c
index a1fe7fefbf..ed27bbd47a 100644
--- a/usr/src/cmd/chgrp/chgrp.c
+++ b/usr/src/cmd/chgrp/chgrp.c
@@ -38,8 +38,6 @@
* contributors.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* chgrp [-fhR] gid file ...
* chgrp -R [-f] [-H|-L|-P] gid file ...
@@ -82,41 +80,18 @@ static int isnumber(char *);
static int Perror(char *);
static void chgrpr(char *, gid_t);
-#ifdef XPG4
-/*
- * Check to see if we are to follow symlinks specified on the command line.
- * This assumes we've already checked to make sure neither -h or -P was
- * specified, so we are just looking to see if -R -L, or -R -H was specified,
- * or, since -R has the same behavior as -R -L, if -R was specified by itself.
- * Therefore, all we really need to check for is if -R was specified.
- */
-#define FOLLOW_CL_LINKS (rflag)
-#else
/*
* Check to see if we are to follow symlinks specified on the command line.
* This assumes we've already checked to make sure neither -h or -P was
* specified, so we are just looking to see if -R -L, or -R -H was specified.
- * Note: -R by itself will change the group of a directory referenced by a
- * symlink however it will not follow the symlink to any other part of the
- * file hierarchy.
*/
#define FOLLOW_CL_LINKS (rflag && (Hflag || Lflag))
-#endif
-#ifdef XPG4
-/*
- * Follow symlinks when traversing directories. Since -R behaves the
- * same as -R -L, we always want to follow symlinks to other parts
- * of the file hierarchy unless -H was specified.
- */
-#define FOLLOW_D_LINKS (!Hflag)
-#else
/*
* Follow symlinks when traversing directories. Only follow symlinks
* to other parts of the file hierarchy if -L was specified.
*/
#define FOLLOW_D_LINKS (Lflag)
-#endif
#define CHOWN(f, u, g) if (chown(f, u, g) < 0) { \
status += Perror(f); \
@@ -185,6 +160,13 @@ main(int argc, char *argv[])
default:
usage();
}
+ /*
+ * Set Pflag by default for recursive operations
+ * if no other options were specified.
+ */
+ if (rflag && !(Lflag || Hflag || Pflag || hflag)) {
+ Pflag = 1;
+ }
/*
* Check for sufficient arguments
diff --git a/usr/src/cmd/chown/Makefile b/usr/src/cmd/chown/Makefile
index 622030cf38..9ee61bfc5f 100644
--- a/usr/src/cmd/chown/Makefile
+++ b/usr/src/cmd/chown/Makefile
@@ -19,50 +19,37 @@
# CDDL HEADER END
#
#
-#ident "%Z%%M% %I% %E% SMI"
-#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
PROG= chown
-XPG4PROG= chown
-XD= exobjs.xpg4
EXOBJS= chown.o
-XPG4EXOBJS= exobjs.xpg4/chown.o
include ../Makefile.cmd
-$(XPG4) := CFLAGS += -DXPG4
+ROOTXPG4LINK=$(ROOTXPG4BIN)/$(PROG)
+
CPPFLAGS += -D_FILE_OFFSET_BITS=64
LDLIBS += -lcmdutils -lsec
.KEEP_STATE:
-all: $(PROG) $(XPG4)
+all: $(PROG)
$(PROG): $(EXOBJS)
$(LINK.c) -o $@ $(EXOBJS) $(LDLIBS)
$(POST_PROCESS)
-$(XPG4): $(XD) $(XPG4EXOBJS)
- $(LINK.c) -o $@ $(XPG4EXOBJS) $(LDLIBS)
- $(POST_PROCESS)
-
+$(ROOTXPG4LINK): $(ROOTPROG)
+ -$(RM) $@
+ -$(SYMLINK) ../../bin/chown $@
-install: all $(ROOTPROG) $(ROOTXPG4PROG)
+install: all $(ROOTPROG) $(ROOTXPG4LINK)
clean:
- -@rm -rf $(EXOBJS) $(XD)
+ -@rm -rf $(EXOBJS)
lint: lint_PROG
-$(XPG4EXOBJS): $(XD)
-
-$(XD)/%.o: %.c
- $(COMPILE.c) -o $@ $<
-
-$(XD):
- -@mkdir -p $@
-
include ../Makefile.targ
diff --git a/usr/src/cmd/chown/chown.c b/usr/src/cmd/chown/chown.c
index 319f571384..15db448a5b 100644
--- a/usr/src/cmd/chown/chown.c
+++ b/usr/src/cmd/chown/chown.c
@@ -24,15 +24,13 @@
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* chown [-fhR] uid[:gid] file ...
* chown -R [-f] [-H|-L|-P] uid[:gid] file ...
@@ -76,41 +74,18 @@ static int isnumber(char *);
static void chownr(char *, uid_t, gid_t);
static void usage();
-#ifdef XPG4
-/*
- * Check to see if we are to follow symlinks specified on the command line.
- * This assumes we've already checked to make sure neither -h or -P was
- * specified, so we are just looking to see if -R -H, or -R -L was specified,
- * or, since -R has the same behavior as -R -L, if -R was specified by itself.
- * Therefore, all we really need to check for is if -R was specified.
- */
-#define FOLLOW_CL_LINKS (rflag)
-#else
/*
* Check to see if we are to follow symlinks specified on the command line.
* This assumes we've already checked to make sure neither -h or -P was
* specified, so we are just looking to see if -R -H, or -R -L was specified.
- * Note: -R by itself will change the ownership of a directory referenced by a
- * symlink however it will now follow the symlink to any other part of the
- * file hierarchy.
*/
#define FOLLOW_CL_LINKS (rflag && (Hflag || Lflag))
-#endif
-#ifdef XPG4
-/*
- * Follow symlinks when traversing directories. Since -R behaves the
- * same as -R -L, we always want to follow symlinks to other parts
- * of the file hierarchy unless -H was specified.
- */
-#define FOLLOW_D_LINKS (!Hflag)
-#else
/*
* Follow symlinks when traversing directories. Only follow symlinks
* to other parts of the file hierarchy if -L was specified.
*/
#define FOLLOW_D_LINKS (Lflag)
-#endif
#define CHOWN(f, u, g) if (chown(f, u, g) < 0) { \
status += Perror(f); \
@@ -180,6 +155,13 @@ main(int argc, char *argv[])
}
}
/*
+ * Set Pflag by default for recursive operations
+ * if no other options were specified.
+ */
+ if (rflag && !(Lflag || Hflag || Pflag || hflag)) {
+ Pflag = 1;
+ }
+ /*
* Check for sufficient arguments
* or a usage error.
*/
diff --git a/usr/src/cmd/ksh/builtins/alias.c b/usr/src/cmd/ksh/builtins/alias.c
index a17e2dabd1..88edbc1e9b 100644
--- a/usr/src/cmd/ksh/builtins/alias.c
+++ b/usr/src/cmd/ksh/builtins/alias.c
@@ -68,9 +68,7 @@ bfastpathrec fastpath_builtins[] =
/* This list must be alphabetically sorted for |strcmp()| usage */
{ "basename", b_basename },
{ "cat", b_cat },
- { "chgrp", b_chgrp },
{ "chmod", b_chmod },
- { "chown", b_chown },
#ifdef ENABLE_PERFORMANCE_PARADOXON
{ "cksum", b_cksum },
#endif /* ENABLE_PERFORMANCE_PARADOXON */
@@ -98,7 +96,7 @@ bfastpathrec fastpath_builtins[] =
{ "mkfifo", b_mkfifo },
{ "mktemp", b_mktemp },
{ "mv", b_mv },
- { "paste", b_paste },
+ { "paste", b_paste },
{ "pathchk", b_pathchk },
{ "pids", b_pids },
{ "readlink", b_readlink },
@@ -119,7 +117,7 @@ bfastpathrec fastpath_builtins[] =
{ "uniq", b_uniq },
{ "wc", b_wc },
{ "xgrep", b_xgrep },
- { NULL, (int (*)(int, char **, void *))NULL }
+ { NULL, (int (*)(int, char **, void *))NULL }
};
static inline
diff --git a/usr/src/lib/libshell/common/data/solaris_cmdlist.h b/usr/src/lib/libshell/common/data/solaris_cmdlist.h
index f394e79aa7..ba724a15b1 100644
--- a/usr/src/lib/libshell/common/data/solaris_cmdlist.h
+++ b/usr/src/lib/libshell/common/data/solaris_cmdlist.h
@@ -84,7 +84,7 @@ ASTCMDLIST(chgrp)
ASTCMDLIST(chmod)
ASTCMDLIST(chown)
// XPG4CMDLIST(chown)
-BINCMDLIST(chown)
+// BINCMDLIST(chown)
ASTCMDLIST(cksum)
BINCMDLIST(cksum)
GNUCMDLIST(cksum)
diff --git a/usr/src/man/man1/chgrp.1 b/usr/src/man/man1/chgrp.1
index 795bc56f66..cab549e34b 100644
--- a/usr/src/man/man1/chgrp.1
+++ b/usr/src/man/man1/chgrp.1
@@ -49,7 +49,7 @@
.\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
.\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved
.\"
-.TH CHGRP 1 "Jul 11, 2008"
+.TH CHGRP 1 "Feb 21, 2019"
.SH NAME
chgrp \- change file group ownership
.SH SYNOPSIS
@@ -74,7 +74,6 @@ chgrp \- change file group ownership
.fi
.SH DESCRIPTION
-.sp
.LP
The \fBchgrp\fR utility will set the group ID of the file named by each
\fIfile\fR operand to the group ID specified by the \fIgroup\fR operand.
@@ -136,10 +135,9 @@ set rstchown = 0
\fB_POSIX_CHOWN_RESTRICTED\fR is enabled by default. See \fBsystem\fR(4) and
\fBfpathconf\fR(2).
.SH OPTIONS
-.sp
.LP
The following options are supported.
-.SS "/usr/bin/chgrp and /usr/xpg4/bin/chgrp"
+
.sp
.ne 2
.na
@@ -202,49 +200,34 @@ of the file hierarchy.
.sp
.ne 2
.na
-\fB\fB-s\fR\fR
-.ad
-.RS 6n
-The specified group is Windows SID. This option requires a file system that
-supports storing SIDs, such as ZFS.
-.RE
-
-.sp
-.LP
-Specifying more than one of the mutually-exclusive options \fB-H\fR, \fB-L\fR,
-or \fB-P\fR is not considered an error. The last option specified determines
-the behavior of \fBchgrp\fR.
-.SS "/usr/bin/chgrp"
-.sp
-.ne 2
-.na
\fB\fB-R\fR\fR
.ad
.RS 6n
Recursive. \fBchgrp\fR descends through the directory, and any subdirectories,
setting the specified group \fBID\fR as it proceeds. When a symbolic link is
-encountered, the group of the target file is changed, unless the \fB-h\fR or
-\fB-P\fR option is specified. However, no recursion takes place, unless the
-\fB-H\fR or \fB-L\fR option is specified.
+encountered, the group of the of the symbolic link is changed, unless the
+\fB-H\fR or \fB-L\fR option is specified. Unless the \fB-H\fR, \fB-L\fR,
+or \fB-P\fR option is specified, the \fB-P\fR option is used as the default mode.
.RE
-.SS "/usr/xpg4/bin/chgrp"
.sp
.ne 2
.na
-\fB\fB-R\fR\fR
+\fB\fB-s\fR\fR
.ad
.RS 6n
-Recursive. \fBchgrp\fR descends through the directory, and any subdirectories,
-setting the specified group \fBID\fR as it proceeds. When a symbolic link is
-encountered, the group of the target file is changed, unless the \fB-h\fR or
-\fB-P\fR option is specified. Unless the \fB-H\fR, \fB-L\fR, or \fB-P\fR option
-is specified, the \fB-L\fR option is used as the default mode.
+The specified group is Windows SID. This option requires a file system that
+supports storing SIDs, such as ZFS.
.RE
-.SH OPERANDS
.sp
.LP
+Specifying more than one of the mutually-exclusive options \fB-H\fR, \fB-L\fR,
+or \fB-P\fR is not considered an error. The last option specified determines
+the behavior of \fBchgrp\fR.
+
+.SH OPERANDS
+.LP
The following operands are supported:
.sp
.ne 2
@@ -268,18 +251,15 @@ A path name of a file whose group ID is to be modified.
.RE
.SH USAGE
-.sp
.LP
See \fBlargefile\fR(5) for the description of the behavior of \fBchgrp\fR when
encountering files greater than or equal to 2 Gbyte (2^31 bytes).
.SH ENVIRONMENT VARIABLES
-.sp
.LP
See \fBenviron\fR(5) for descriptions of the following environment variables
that affect the execution of \fBchgrp\fR: \fBLANG\fR, \fBLC_ALL\fR,
\fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
.SH EXIT STATUS
-.sp
.LP
The following exit values are returned:
.sp
@@ -301,7 +281,6 @@ An error occurred.
.RE
.SH FILES
-.sp
.ne 2
.na
\fB\fB/etc/group\fR\fR
@@ -311,30 +290,9 @@ group file
.RE
.SH ATTRIBUTES
-.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
-.SS "/usr/bin/chgrp"
-.sp
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE ATTRIBUTE VALUE
-_
-CSI Enabled. See NOTES.
-_
-Interface Stability Committed
-_
-Standard See \fBstandards\fR(5).
-.TE
-
-.SS "/usr/xpg4/bin/chgrp"
-.sp
-
-.sp
.TS
box;
c | c
@@ -349,12 +307,14 @@ Standard See \fBstandards\fR(5).
.TE
.SH SEE ALSO
-.sp
.LP
\fBchmod\fR(1), \fBchown\fR(1), \fBid\fR(1M), \fBchown\fR(2),
\fBfpathconf\fR(2), \fBgroup\fR(4), \fBpasswd\fR(4), \fBsystem\fR(4),
\fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5)
.SH NOTES
-.sp
.LP
\fBchgrp\fR is CSI-enabled except for the \fIgroup\fR name.
+.sp
+.LP
+In the past the behavior of \fB/usr/xpg4/bin/chgrp\fR and
+\fB/usr/bin/chgrp\fR utilities was different. Now they behave the same way.
diff --git a/usr/src/man/man1/chown.1 b/usr/src/man/man1/chown.1
index f309fa3e37..6ec6a8247a 100644
--- a/usr/src/man/man1/chown.1
+++ b/usr/src/man/man1/chown.1
@@ -45,61 +45,31 @@
.\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
.\"
-.TH CHOWN 1 "Jul 11, 2008"
+.TH CHOWN 1 "Feb 21, 2019"
.SH NAME
chown \- change file ownership
.SH SYNOPSIS
-.SS "/usr/bin/chown"
.LP
.nf
-\fB/usr/bin/chown\fR [\fB-fhR\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
+\fBchown\fR [\fB-fhR\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
.fi
.LP
.nf
-\fB/usr/bin/chown\fR \fB-s\fR [\fB-fhR\fR] \fIownersid\fR[:\fIgroupsid\fR] \fIfile\fR...
+\fBchown\fR \fB-s\fR [\fB-fhR\fR] \fIownersid\fR[:\fIgroupsid\fR] \fIfile\fR...
.fi
.LP
.nf
-\fB/usr/bin/chown\fR \fB-R\fR [\fB-f\fR] [\fB-H\fR | \fB-L\fR | \fB-P\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
+\fBchown\fR \fB-R\fR [\fB-f\fR] [\fB-H\fR | \fB-L\fR | \fB-P\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
.fi
.LP
.nf
-\fB/usr/bin/chown\fR \fB-s\fR \fB-R\fR [\fB-f\fR] [\fB-H\fR | \fB-L\fR | \fB-P\fR] \fIownersid\fR[:\fIgroupsid\fR] \fIfile\fR...
-.fi
-
-.SS "/usr/xpg4/bin/chown"
-.LP
-.nf
-\fB/usr/xpg4/bin/chown\fR [\fB-fhR\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
-.fi
-
-.LP
-.nf
-\fB/usr/xpg4/bin/chown\fR \fB-s\fR [\fB-fhR\fR] \fIownersid\fR[:\fIgroupsid\fR] \fIfile\fR...
-.fi
-
-.LP
-.nf
-\fB/usr/xpg4/bin/chown\fR \fB-R\fR [\fB-f\fR] [\fB-H\fR | \fB-L\fR | \fB-P\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
-.fi
-
-.LP
-.nf
-\fB/usr/xpg4/bin/chown\fR \fB-s\fR \fB-R\fR [\fB-f\fR] [\fB-H\fR | \fB-L\fR | \fB-P\fR] \fIownersid\fR[:\fIgroupsid\fR] \fIfile\fR...
-.fi
-
-.SS "ksh93"
-.LP
-.nf
-\fBchown\fR [\fB-cflhmnvHLPRX\fR] [\fB-r\fR \fIfile\fR] \fIowner\fR[:\fIgroup\fR] \fIfile\fR...
+\fBchown\fR \fB-s\fR \fB-R\fR [\fB-f\fR] [\fB-H\fR | \fB-L\fR | \fB-P\fR] \fIownersid\fR[:\fIgroupsid\fR] \fIfile\fR...
.fi
.SH DESCRIPTION
-.SS "/usr/bin/chown and /usr/xpg4/bin/chown"
-.sp
.LP
The \fBchown\fR utility sets the user \fBID\fR of the file named by each
\fBfile\fR to the user \fBID\fR specified by \fIowner\fR, and, optionally, sets
@@ -142,22 +112,7 @@ To disable this option, include the following line in \fB/etc/system\fR:
.LP
\fB{_POSIX_CHOWN_RESTRICTED}\fR is enabled by default. See \fBsystem\fR(4) and
\fBfpathconf\fR(2).
-.SS "ksh93"
-.sp
-.LP
-The \fBchown\fR built-in in \fBksh93\fR is associated with the \fB/bin\fR and
-\fB/usr/bin\fR paths. It is invoked when \fBchown\fR is executed without a
-pathname prefix and the pathname search finds a \fB/bin/chown\fR or
-/usr/bin/chown executable.
-.sp
-.LP
-\fBchown\fR changes the ownership of each file to \fIowner\fR. \fIowner\fR can
-be specified as either a user name or a numeric user id. The group ownership of
-each file can also be changed to \fIgroup\fR by appending \fI:group\fR to the
-user name.
.SH OPTIONS
-.SS "/usr/bin/chown and /usr/xpg4/bin/chown"
-.sp
.LP
The following options are supported:
.sp
@@ -222,239 +177,33 @@ of the file hierarchy.
.sp
.ne 2
.na
-\fB\fB-s\fR\fR
-.ad
-.RS 6n
-The owner and/or group arguments are Windows SID strings. This option requires
-a file system that supports storing SIDs, such as ZFS.
-.RE
-
-.sp
-.LP
-Specifying more than one of the mutually-exclusive options \fB-H\fR, \fB-L\fR,
-or \fB-P\fR is not considered an error. The last option specified determines
-the behavior of \fBchown\fR.
-.SS "/usr/bin/chown"
-.sp
-.LP
-The following options are supported:
-.sp
-.ne 2
-.na
\fB\fB-R\fR\fR
.ad
.RS 6n
Recursive. \fBchown\fR descends through the directory, and any subdirectories,
setting the specified ownership \fBID\fR as it proceeds. When a symbolic link
-is encountered, the owner of the target file is changed, unless the \fB-h\fR or
-\fB-P\fR option is specified. However, no recursion takes place, unless the
-\fB-H\fR or \fB-L\fR option is specified.
+is encountered, the owner of the symbolic link is changed, unless the
+\fB-H\fR or \fB-L\fR option is specified. Unless the \fB-H\fR, \fB-L\fR, or \fB-P\fR
+option is specified, the \fB-P\fR option is used as the default mode.
.RE
-.SS "/usr/xpg4/bin/chown"
-.sp
-.LP
-The following options are supported:
.sp
.ne 2
.na
-\fB\fB-R\fR\fR
+\fB\fB-s\fR\fR
.ad
.RS 6n
-Recursive. \fBchown\fR descends through the directory, and any subdirectories,
-setting the specified ownership \fBID\fR as it proceeds. When a symbolic link
-is encountered, the owner of the target file is changed, unless the \fB-h\fR or
-\fB-P\fR option is specified. Unless the \fB-H\fR, \fB-L\fR, or \fB-P\fR option
-is specified, the \fB-L\fR option is used as the default mode.
+The owner and/or group arguments are Windows SID strings. This option requires
+a file system that supports storing SIDs, such as ZFS.
.RE
-.SS "ksh93"
.sp
.LP
-The following options are supported by the \fBksh93\fR built-in \fBchown\fR
-command:
-.sp
-.ne 2
-.na
-\fB\fB-c\fR\fR
-.ad
-.br
-.na
-\fB\fB--changes\fR\fR
-.ad
-.sp .6
-.RS 4n
-Describe only files whose ownership actually changes.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-f\fR\fR
-.ad
-.br
-.na
-\fB\fB--quiet | silent\fR\fR
-.ad
-.sp .6
-.RS 4n
-Do not report files whose ownership fails to change.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-l | h\fR\fR
-.ad
-.br
-.na
-\fB\fB--symlink\fR\fR
-.ad
-.sp .6
-.RS 4n
-Change the ownership of the symbolic links on systems that support this option.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-m\fR\fR
-.ad
-.br
-.na
-\fB\fB--map\fR\fR
-.ad
-.sp .6
-.RS 4n
-Interpret the first operand as a file that contains a map of:
-.sp
-.in +2
-.nf
-\fIfrom_uid\fR:\fIfrom_gid to_uid:to_gid\fR
-.fi
-.in -2
-.sp
-
-pairs. Ownership of files matching the \fIfrom\fR part of any pair is changed
-to the corresponding \fIto\fR part of the pair. The process stops at the first
-match for each file. Unmatched files are silently ignored.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-n\fR\fR
-.ad
-.br
-.na
-\fB\fB--show\fR\fR
-.ad
-.sp .6
-.RS 4n
-Show actions but do not execute.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-r\fR\fR
-.ad
-.br
-.na
-\fB\fB--reference=file\fR\fR
-.ad
-.sp .6
-.RS 4n
-Omit the explicit ownership operand and use the ownership of the file instead.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-v\fR\fR
-.ad
-.br
-.na
-\fB\fB--verbose\fR\fR
-.ad
-.sp .6
-.RS 4n
-Describe the changed permissions of all files.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-H\fR\fR
-.ad
-.br
-.na
-\fB\fB--metaphysical\fR\fR
-.ad
-.sp .6
-.RS 4n
-Follow symbolic links for command arguments. Otherwise do not follow symbolic
-links when traversing directories.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-L\fR\fR
-.ad
-.br
-.na
-\fB\fB--logical | follow\fR\fR
-.ad
-.sp .6
-.RS 4n
-Follow symbolic links when traversing directories.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-P\fR\fR
-.ad
-.br
-.na
-\fB\fB--physical | nofollow\fR\fR
-.ad
-.sp .6
-.RS 4n
-Do not follow symbolic links when traversing directories.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-R\fR\fR
-.ad
-.br
-.na
-\fB\fB--recursive\fR\fR
-.ad
-.sp .6
-.RS 4n
-Recursively change ownership of directories and their contents.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-X\fR\fR
-.ad
-.br
-.na
-\fB\fB--test\fR\fR
-.ad
-.sp .6
-.RS 4n
-Canonicalize output for testing.
-.RE
+Specifying more than one of the mutually-exclusive options \fB-H\fR, \fB-L\fR,
+or \fB-P\fR is not considered an error. The last option specified determines
+the behavior of \fBchown\fR.
.SH OPERANDS
-.sp
.LP
The following operands are supported:
.sp
@@ -486,7 +235,6 @@ A path name of a file whose user \fBID\fR is to be modified.
.RE
.SH USAGE
-.sp
.LP
See \fBlargefile\fR(5) for the description of the behavior of \fBchown\fR when
encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
@@ -507,13 +255,11 @@ example% \fBchown \(miR \(mih \fIowner\fR[:group] \fIfile\fR...\fR
.sp
.SH ENVIRONMENT VARIABLES
-.sp
.LP
See \fBenviron\fR(5) for descriptions of the following environment variables
that affect the execution of \fBchown\fR: \fBLANG\fR, \fBLC_ALL\fR,
\fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
.SH EXIT STATUS
-.sp
.LP
The following exit values are returned:
.sp
@@ -535,7 +281,6 @@ An error occurred.
.RE
.SH FILES
-.sp
.ne 2
.na
\fB\fB/etc/passwd\fR\fR
@@ -545,28 +290,8 @@ System password file
.RE
.SH ATTRIBUTES
-.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
-.SS "/usr/bin/chown"
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE ATTRIBUTE VALUE
-_
-CSI Enabled. See NOTES.
-_
-Interface Stability Committed
-_
-Standard See \fBstandards\fR(5).
-.TE
-
-.SS "/usr/xpg4/bin/chown"
-.sp
.sp
.TS
@@ -582,31 +307,16 @@ _
Standard See \fBstandards\fR(5).
.TE
-.SS "ksh93"
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE ATTRIBUTE VALUE
-_
-Interface Stability See below.
-.TE
-
-.sp
-.LP
-The \fBksh93\fR built-in binding to \fB/bin\fR and \fB/usr/bin\fR is Volatile.
-The built-in interfaces are Uncommitted.
.SH SEE ALSO
-.sp
.LP
\fBchgrp\fR(1), \fBchmod\fR(1), \fBksh93\fR(1), \fBchown\fR(2),
\fBfpathconf\fR(2), \fBpasswd\fR(4), \fBsystem\fR(4), \fBattributes\fR(5),
\fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5)
.SH NOTES
-.sp
.LP
\fBchown\fR is \fBCSI\fR-enabled except for the \fIowner\fR and \fIgroup\fR
names.
+.sp
+.LP
+In the past the behavior of \fB/usr/xpg4/bin/chown\fR and
+\fB/usr/bin/chown\fR utilities was different. Now they behave the same way.
diff --git a/usr/src/pkg/manifests/system-test-utiltest.mf b/usr/src/pkg/manifests/system-test-utiltest.mf
index 5fdd891b11..3ed9baeba5 100644
--- a/usr/src/pkg/manifests/system-test-utiltest.mf
+++ b/usr/src/pkg/manifests/system-test-utiltest.mf
@@ -1118,6 +1118,7 @@ file path=opt/util-tests/tests/awk/tests/T.redir mode=0555
file path=opt/util-tests/tests/awk/tests/T.split mode=0555
file path=opt/util-tests/tests/awk/tests/T.sub mode=0555
file path=opt/util-tests/tests/awk/tests/T.system mode=0555
+file path=opt/util-tests/tests/chown_test mode=0555
file path=opt/util-tests/tests/date_test mode=0555
file path=opt/util-tests/tests/demangle/afl-fast mode=0555
file path=opt/util-tests/tests/demangle/gcc-libstdc++ mode=0555
@@ -1291,6 +1292,18 @@ file path=opt/util-tests/tests/dis/risc-v/tst.supervisor.out mode=0444
file path=opt/util-tests/tests/dis/risc-v/tst.supervisor.s mode=0444
file path=opt/util-tests/tests/dis/sparc/tst.regs.out mode=0444
file path=opt/util-tests/tests/dis/sparc/tst.regs.s mode=0444
+file path=opt/util-tests/tests/files/cout0 mode=0444
+file path=opt/util-tests/tests/files/cout1 mode=0444
+file path=opt/util-tests/tests/files/cout10 mode=0444
+file path=opt/util-tests/tests/files/cout11 mode=0444
+file path=opt/util-tests/tests/files/cout2 mode=0444
+file path=opt/util-tests/tests/files/cout3 mode=0444
+file path=opt/util-tests/tests/files/cout4 mode=0444
+file path=opt/util-tests/tests/files/cout5 mode=0444
+file path=opt/util-tests/tests/files/cout6 mode=0444
+file path=opt/util-tests/tests/files/cout7 mode=0444
+file path=opt/util-tests/tests/files/cout8 mode=0444
+file path=opt/util-tests/tests/files/cout9 mode=0444
file path=opt/util-tests/tests/files/gout0 mode=0444
file path=opt/util-tests/tests/files/gout1 mode=0444
file path=opt/util-tests/tests/files/gout10 mode=0444
diff --git a/usr/src/pkg/manifests/system-xopen-xcu4.mf b/usr/src/pkg/manifests/system-xopen-xcu4.mf
index c9de2bb7fa..b7f5733eb4 100644
--- a/usr/src/pkg/manifests/system-xopen-xcu4.mf
+++ b/usr/src/pkg/manifests/system-xopen-xcu4.mf
@@ -38,8 +38,6 @@ file path=usr/xpg4/bin/at group=sys mode=4755
file path=usr/xpg4/bin/awk mode=0555
file path=usr/xpg4/bin/basename mode=0555
file path=usr/xpg4/bin/batch mode=0555
-file path=usr/xpg4/bin/chgrp mode=0555
-file path=usr/xpg4/bin/chown mode=0555
file path=usr/xpg4/bin/cp mode=0555
file path=usr/xpg4/bin/crontab mode=4555
file path=usr/xpg4/bin/ctags mode=0555
@@ -83,6 +81,8 @@ license lic_OSBL_preamble license=lic_OSBL_preamble
link path=usr/xpg4/bin/alias target=../../bin/alias
link path=usr/xpg4/bin/bg target=../../bin/alias
link path=usr/xpg4/bin/cd target=../../bin/alias
+link path=usr/xpg4/bin/chgrp target=../../bin/chgrp
+link path=usr/xpg4/bin/chown target=../../bin/chown
link path=usr/xpg4/bin/command target=../../bin/alias
link path=usr/xpg4/bin/df target=../../sbin/df
link path=usr/xpg4/bin/egrep target=../../bin/grep
diff --git a/usr/src/test/util-tests/runfiles/default.run b/usr/src/test/util-tests/runfiles/default.run
index b328670f8e..3cccf62ac9 100644
--- a/usr/src/test/util-tests/runfiles/default.run
+++ b/usr/src/test/util-tests/runfiles/default.run
@@ -52,6 +52,7 @@ tests = [ 'runtests.sh' ]
[/opt/util-tests/tests/grep_test]
[/opt/util-tests/tests/date_test]
+[/opt/util-tests/tests/chown_test]
[/opt/util-tests/tests/demangle]
tests = ['afl-fast', 'gcc-libstdc++', 'llvm-stdcxxabi']
diff --git a/usr/src/test/util-tests/tests/Makefile b/usr/src/test/util-tests/tests/Makefile
index f947f4dc71..936f7c920a 100644
--- a/usr/src/test/util-tests/tests/Makefile
+++ b/usr/src/test/util-tests/tests/Makefile
@@ -18,7 +18,7 @@
#
SUBDIRS = date dis dladm iconv libnvpair_json libsff printf xargs grep_xpg4
-SUBDIRS += demangle mergeq workq
+SUBDIRS += demangle mergeq workq chown
SUBDIRS += bunyan awk smbios libjedec
include $(SRC)/test/Makefile.com
diff --git a/usr/src/test/util-tests/tests/chown/Makefile b/usr/src/test/util-tests/tests/chown/Makefile
new file mode 100644
index 0000000000..52c70f8b3c
--- /dev/null
+++ b/usr/src/test/util-tests/tests/chown/Makefile
@@ -0,0 +1,45 @@
+#
+# 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 (c) 2013 by Delphix. All rights reserved.
+# Copyright 2014 Nexenta Systems, Inc. All rights reserved.
+# Copyright 2019 Alexander Pyhalov
+#
+
+.PARALLEL: $(SUBDIRS)
+
+include $(SRC)/cmd/Makefile.cmd
+include $(SRC)/test/Makefile.com
+
+ROOTOPTPKG = $(ROOT)/opt/util-tests
+TESTDIR = $(ROOTOPTPKG)/tests
+
+PROGS = chown_test
+
+CMDS = $(PROGS:%=$(TESTDIR)/%)
+$(CMDS) := FILEMODE = 0555
+
+all lint clean clobber:
+
+install: $(CMDS)
+
+$(CMDS): $(TESTDIR)
+
+$(TESTDIR):
+ $(INS.dir)
+
+$(TESTDIR)/%: %.ksh
+ $(INS.rename)
+
+SUBDIRS = files
+
+include $(SRC)/test/Makefile.com
diff --git a/usr/src/test/util-tests/tests/chown/chown_test.ksh b/usr/src/test/util-tests/tests/chown/chown_test.ksh
new file mode 100644
index 0000000000..d3f3478a9d
--- /dev/null
+++ b/usr/src/test/util-tests/tests/chown/chown_test.ksh
@@ -0,0 +1,103 @@
+#! /usr/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 2017 Nexenta Systems, Inc. All rights reserved.
+# Copyright 2019 Alexander Pyhalov
+#
+
+CHOWN=${CHOWN:=/usr/bin/chown}
+FILEDIR=/opt/util-tests/tests/files
+
+fail() {
+ echo $1
+ exit -1
+}
+
+create_test_hier() {
+ mkdir -p $1/src $1/dst
+ touch $1/target
+ touch $1/file
+ touch $1/dst/file1
+ touch $1/src/file2
+ ln -s ../target $1/src/tlink
+ ln -s ../dst $1/src/dstlink
+ ln -s target $1/tlink
+}
+
+SUCCESSFLAGS="
+-f
+-h
+-fhR
+-R
+-RH
+-RP
+-RL
+-Rh
+-RHL
+-RPH
+-RLP"
+
+FAILFLAGS="-RPh
+-RLh
+-RHh
+-P
+-H
+-L"
+
+NEWOWNER=daemon
+
+# We set PATH to /bin to try get ksh chown builtin
+# and to ensure that /usr/bin/chown is used instead.
+export PATH=/bin
+
+# We want unified output from tools
+export LC_ALL=en_US.UTF-8
+
+i=0
+echo "$SUCCESSFLAGS" | while read flags; do
+ print -n "test $i: chown $flags: "
+ TD=$(mktemp -d -t)
+ if [ -d "$TD" ]; then
+ create_test_hier $TD
+ chown $flags $NEWOWNER $TD/src || fail "chown $flags $NEWOWNER $TD/src failed on exit"
+ chown $flags $NEWOWNER $TD/tlink || fail "chown $flags $NEWOWNER $TD/tlink failed on exit"
+ chown $flags $NEWOWNER $TD/file || fail "chown $flags $NEWOWNER $TD/file failed on exit"
+ (cd $TD ; find . -ls |\
+ awk ' { print $3 " " $5 " " $11 }'|\
+ sort -k 3 > /tmp/out.$$)
+ if [ -n "$(diff /tmp/out.$$ $FILEDIR/cout$i)" ]; then
+ print "$(diff -u /tmp/out.$$ $FILEDIR/cout$i)"
+ fail "result is different"
+ fi
+ echo "passed"
+ rm -fr $TD /tmp/out.$$
+ else
+ fail "couldn't create $TD"
+ fi
+ ((i++))
+done
+
+echo "$FAILFLAGS" | while read flags; do
+ print -n "test $i: chown $flags: "
+ TD=$(mktemp -d -t)
+ if [ -d "$TD" ]; then
+ create_test_hier $TD
+ chown $flags $NEWOWNER $TD/file && fail "chown $flags $NEWOWNER $TD/file should have failed"
+ echo "passed"
+ rm -fr $TD
+ else
+ fail "couldn't create $TD"
+ fi
+ ((i++))
+done
diff --git a/usr/src/test/util-tests/tests/chown/files/Makefile b/usr/src/test/util-tests/tests/chown/files/Makefile
new file mode 100644
index 0000000000..4c46abaa63
--- /dev/null
+++ b/usr/src/test/util-tests/tests/chown/files/Makefile
@@ -0,0 +1,50 @@
+#
+# 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 (c) 2013 by Delphix. All rights reserved.
+# Copyright 2014 Nexenta Systems, Inc. All rights reserved.
+# Copyright 2019 Alexander Pyhalov
+#
+
+include $(SRC)/cmd/Makefile.cmd
+include $(SRC)/test/Makefile.com
+
+ROOTOPTPKG = $(ROOT)/opt/util-tests
+TESTDIR = $(ROOTOPTPKG)/tests/files
+
+PROGS = cout0 \
+ cout1 \
+ cout2 \
+ cout3 \
+ cout4 \
+ cout5 \
+ cout6 \
+ cout7 \
+ cout8 \
+ cout9 \
+ cout10 \
+ cout11
+
+CMDS = $(PROGS:%=$(TESTDIR)/%)
+$(CMDS) := FILEMODE = 0444
+
+all lint clean clobber:
+
+install: $(CMDS)
+
+$(CMDS): $(TESTDIR)
+
+$(TESTDIR):
+ $(INS.dir)
+
+$(TESTDIR)/%: %
+ $(INS.file)
diff --git a/usr/src/test/util-tests/tests/chown/files/cout0 b/usr/src/test/util-tests/tests/chown/files/cout0
new file mode 100644
index 0000000000..d12a3e0a90
--- /dev/null
+++ b/usr/src/test/util-tests/tests/chown/files/cout0
@@ -0,0 +1,10 @@
+drwx------ root .
+drwxr-xr-x root ./dst
+-rw-r--r-- root ./dst/file1
+-rw-r--r-- daemon ./file
+drwxr-xr-x daemon ./src
+lrwxrwxrwx root ./src/dstlink
+-rw-r--r-- root ./src/file2
+lrwxrwxrwx root ./src/tlink
+-rw-r--r-- daemon ./target
+lrwxrwxrwx root ./tlink
diff --git a/usr/src/test/util-tests/tests/chown/files/cout1 b/usr/src/test/util-tests/tests/chown/files/cout1
new file mode 100644
index 0000000000..d12a3e0a90
--- /dev/null
+++ b/usr/src/test/util-tests/tests/chown/files/cout1
@@ -0,0 +1,10 @@
+drwx------ root .
+drwxr-xr-x root ./dst
+-rw-r--r-- root ./dst/file1
+-rw-r--r-- daemon ./file
+drwxr-xr-x daemon ./src
+lrwxrwxrwx root ./src/dstlink
+-rw-r--r-- root ./src/file2
+lrwxrwxrwx root ./src/tlink
+-rw-r--r-- daemon ./target
+lrwxrwxrwx root ./tlink
diff --git a/usr/src/test/util-tests/tests/chown/files/cout10 b/usr/src/test/util-tests/tests/chown/files/cout10
new file mode 100644
index 0000000000..f128e53d0a
--- /dev/null
+++ b/usr/src/test/util-tests/tests/chown/files/cout10
@@ -0,0 +1,10 @@
+drwx------ root .
+drwxr-xr-x daemon ./dst
+-rw-r--r-- root ./dst/file1
+-rw-r--r-- daemon ./file
+drwxr-xr-x daemon ./src
+lrwxrwxrwx root ./src/dstlink
+-rw-r--r-- daemon ./src/file2
+lrwxrwxrwx root ./src/tlink
+-rw-r--r-- daemon ./target
+lrwxrwxrwx root ./tlink
diff --git a/usr/src/test/util-tests/tests/chown/files/cout11 b/usr/src/test/util-tests/tests/chown/files/cout11
new file mode 100644
index 0000000000..e990d2c3d7
--- /dev/null
+++ b/usr/src/test/util-tests/tests/chown/files/cout11
@@ -0,0 +1,10 @@
+drwx------ root .
+drwxr-xr-x root ./dst
+-rw-r--r-- root ./dst/file1
+-rw-r--r-- daemon ./file
+drwxr-xr-x daemon ./src
+lrwxrwxrwx daemon ./src/dstlink
+-rw-r--r-- daemon ./src/file2
+lrwxrwxrwx daemon ./src/tlink
+-rw-r--r-- root ./target
+lrwxrwxrwx daemon ./tlink
diff --git a/usr/src/test/util-tests/tests/chown/files/cout12 b/usr/src/test/util-tests/tests/chown/files/cout12
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/usr/src/test/util-tests/tests/chown/files/cout12
diff --git a/usr/src/test/util-tests/tests/chown/files/cout2 b/usr/src/test/util-tests/tests/chown/files/cout2
new file mode 100644
index 0000000000..68b3cfaf8b
--- /dev/null
+++ b/usr/src/test/util-tests/tests/chown/files/cout2
@@ -0,0 +1,10 @@
+drwx------ root .
+drwxr-xr-x root ./dst
+-rw-r--r-- root ./dst/file1
+-rw-r--r-- daemon ./file
+drwxr-xr-x daemon ./src
+lrwxrwxrwx root ./src/dstlink
+-rw-r--r-- root ./src/file2
+lrwxrwxrwx root ./src/tlink
+-rw-r--r-- root ./target
+lrwxrwxrwx daemon ./tlink
diff --git a/usr/src/test/util-tests/tests/chown/files/cout3 b/usr/src/test/util-tests/tests/chown/files/cout3
new file mode 100644
index 0000000000..e990d2c3d7
--- /dev/null
+++ b/usr/src/test/util-tests/tests/chown/files/cout3
@@ -0,0 +1,10 @@
+drwx------ root .
+drwxr-xr-x root ./dst
+-rw-r--r-- root ./dst/file1
+-rw-r--r-- daemon ./file
+drwxr-xr-x daemon ./src
+lrwxrwxrwx daemon ./src/dstlink
+-rw-r--r-- daemon ./src/file2
+lrwxrwxrwx daemon ./src/tlink
+-rw-r--r-- root ./target
+lrwxrwxrwx daemon ./tlink
diff --git a/usr/src/test/util-tests/tests/chown/files/cout4 b/usr/src/test/util-tests/tests/chown/files/cout4
new file mode 100644
index 0000000000..e990d2c3d7
--- /dev/null
+++ b/usr/src/test/util-tests/tests/chown/files/cout4
@@ -0,0 +1,10 @@
+drwx------ root .
+drwxr-xr-x root ./dst
+-rw-r--r-- root ./dst/file1
+-rw-r--r-- daemon ./file
+drwxr-xr-x daemon ./src
+lrwxrwxrwx daemon ./src/dstlink
+-rw-r--r-- daemon ./src/file2
+lrwxrwxrwx daemon ./src/tlink
+-rw-r--r-- root ./target
+lrwxrwxrwx daemon ./tlink
diff --git a/usr/src/test/util-tests/tests/chown/files/cout5 b/usr/src/test/util-tests/tests/chown/files/cout5
new file mode 100644
index 0000000000..f128e53d0a
--- /dev/null
+++ b/usr/src/test/util-tests/tests/chown/files/cout5
@@ -0,0 +1,10 @@
+drwx------ root .
+drwxr-xr-x daemon ./dst
+-rw-r--r-- root ./dst/file1
+-rw-r--r-- daemon ./file
+drwxr-xr-x daemon ./src
+lrwxrwxrwx root ./src/dstlink
+-rw-r--r-- daemon ./src/file2
+lrwxrwxrwx root ./src/tlink
+-rw-r--r-- daemon ./target
+lrwxrwxrwx root ./tlink
diff --git a/usr/src/test/util-tests/tests/chown/files/cout6 b/usr/src/test/util-tests/tests/chown/files/cout6
new file mode 100644
index 0000000000..e990d2c3d7
--- /dev/null
+++ b/usr/src/test/util-tests/tests/chown/files/cout6
@@ -0,0 +1,10 @@
+drwx------ root .
+drwxr-xr-x root ./dst
+-rw-r--r-- root ./dst/file1
+-rw-r--r-- daemon ./file
+drwxr-xr-x daemon ./src
+lrwxrwxrwx daemon ./src/dstlink
+-rw-r--r-- daemon ./src/file2
+lrwxrwxrwx daemon ./src/tlink
+-rw-r--r-- root ./target
+lrwxrwxrwx daemon ./tlink
diff --git a/usr/src/test/util-tests/tests/chown/files/cout7 b/usr/src/test/util-tests/tests/chown/files/cout7
new file mode 100644
index 0000000000..dcf411a1e5
--- /dev/null
+++ b/usr/src/test/util-tests/tests/chown/files/cout7
@@ -0,0 +1,10 @@
+drwx------ root .
+drwxr-xr-x daemon ./dst
+-rw-r--r-- daemon ./dst/file1
+-rw-r--r-- daemon ./file
+drwxr-xr-x daemon ./src
+lrwxrwxrwx root ./src/dstlink
+-rw-r--r-- daemon ./src/file2
+lrwxrwxrwx root ./src/tlink
+-rw-r--r-- daemon ./target
+lrwxrwxrwx root ./tlink
diff --git a/usr/src/test/util-tests/tests/chown/files/cout8 b/usr/src/test/util-tests/tests/chown/files/cout8
new file mode 100644
index 0000000000..e990d2c3d7
--- /dev/null
+++ b/usr/src/test/util-tests/tests/chown/files/cout8
@@ -0,0 +1,10 @@
+drwx------ root .
+drwxr-xr-x root ./dst
+-rw-r--r-- root ./dst/file1
+-rw-r--r-- daemon ./file
+drwxr-xr-x daemon ./src
+lrwxrwxrwx daemon ./src/dstlink
+-rw-r--r-- daemon ./src/file2
+lrwxrwxrwx daemon ./src/tlink
+-rw-r--r-- root ./target
+lrwxrwxrwx daemon ./tlink
diff --git a/usr/src/test/util-tests/tests/chown/files/cout9 b/usr/src/test/util-tests/tests/chown/files/cout9
new file mode 100644
index 0000000000..dcf411a1e5
--- /dev/null
+++ b/usr/src/test/util-tests/tests/chown/files/cout9
@@ -0,0 +1,10 @@
+drwx------ root .
+drwxr-xr-x daemon ./dst
+-rw-r--r-- daemon ./dst/file1
+-rw-r--r-- daemon ./file
+drwxr-xr-x daemon ./src
+lrwxrwxrwx root ./src/dstlink
+-rw-r--r-- daemon ./src/file2
+lrwxrwxrwx root ./src/tlink
+-rw-r--r-- daemon ./target
+lrwxrwxrwx root ./tlink