#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
#
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
#
# DESCRIPTION:
#
# Basic applications work with xattrs: cpio cp find mv pax tar
#
# STRATEGY:
# 1. For each application
# 3. Also check that when appropriate flag is not used, the xattr
# doesn't get copied
#
}
log_assert "Basic applications work with xattrs: cpio cp find mv pax tar"
# Create a file, and set an xattr on it. This file is used in several of the
# test scenarios below.
# For the archive applications below (tar, cpio, pax)
# we create two archives, one with xattrs, one without
# and try various cpio options extracting the archives
# with and without xattr support, checking for correct behaviour
log_note "Checking cpio"
# we should have no xattr here
log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1"
# we should have an xattr here
# we should have no xattr here
log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1"
# we should have no xattr here
log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1"
log_note "Checking cp"
# check that with the right flag, the xattr is preserved
# without the right flag, there should be no xattr
log_mustnot eval "runat $TESTDIR/myfile2.$$ ls passwd > /dev/null 2>&1"
log_note "Checking find"
# create a file without xattrs, and check that find -xattr only finds
# our test file that has an xattr.
[[ $? -ne 0 ]] && \
log_fail "find -xattr didn't find our file that had an xattr."
[[ $? -eq 0 ]] && \
log_fail "find -xattr found a file that didn't have an xattr."
log_note "Checking mv"
# always moved.
log_note "Checking pax"
# we should have no xattr here
log_mustnot eval "runat $TESTDIR/pax.$$ cat passwd > /dev/null 2>&1"
# we should have no xattr here
log_mustnot eval "runat $TESTDIR/pax.$$ cat passwd > /dev/null 2>&1"
# we should have an xattr here
# we should have no xattr here
log_mustnot eval "runat $TESTDIR/pax.$$ cat passwd > /dev/null 2>&1"
log_note "Checking tar"
# we should have no xattr here
log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1"
# we should have an xattr here
# we should have no xattr here
log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1"
# we should have no xattr here
log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1"
log_assert "Basic applications work with xattrs: cpio cp find mv pax tar"