1#!/usr/local/bin/ksh93 -p 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26 27. $STF_SUITE/tests/acl/acl_common.kshlib 28 29################################################################################# 30# 31# __stc_assertion_start 32# 33# ID: zfs_acl_find_002_neg 34# 35# DESCRIPTION: 36# Verifies ability to find files with attribute with -xattr flag and using 37# "-exec runat ls". 38# 39# STRATEGY: 40# 1. In directory A, create several files and add attribute files for them 41# 2. Delete all the attribute files. 42# 2. Verify all the specified files can not be found with '-xattr', 43# 3. Verify all the attribute files can not be found with '-exec runat ls' 44# 45# TESTABILITY: explicit 46# 47# TEST_AUTOMATION_LEVEL: automated 48# 49# CODING_STATUS: COMPLETED (2006-06-01) 50# 51# __stc_assertion_end 52# 53################################################################################ 54 55verify_runnable "both" 56 57log_assert "verifies -xattr doesn't include files without " \ 58 "attribute and using '-exec runat ls'" 59log_onexit cleanup 60 61test_requires RUNAT ZFS_ACL ZFS_XATTR 62 63for user in root $ZFS_ACL_STAFF1; do 64 log_must set_cur_usr $user 65 66 log_must create_files $TESTDIR 67 68 initfiles=$($LS -R $INI_DIR/*) 69 typeset -i i=0 70 while (( i < NUM_FILE )); do 71 f=$(getitem $i $initfiles) 72 usr_exec $RUNAT $f $RM attribute* 73 (( i += 1 )) 74 done 75 76 i=0 77 while (( i < NUM_FILE )); do 78 f=$(getitem $i $initfiles) 79 ff=$(usr_exec $FIND $INI_DIR -type f -name ${f##*/} \ 80 -xattr -print) 81 if [[ $ff == $f ]]; then 82 log_fail "find not containing attribute should fail." 83 fi 84 85 typeset -i j=0 86 while (( j < NUM_ATTR )); do 87 fa=$(usr_exec $FIND $INI_DIR -type f -name ${f##*/} \ 88 -xattr -exec $RUNAT {} $LS attribute.$j \\\;) 89 if [[ $fa == attribute.$j ]]; then 90 log_fail "find file attribute should fail." 91 fi 92 (( j += 1 )) 93 done 94 log_note "Failed to find $f and its attribute file as expected." 95 96 (( i += 1 )) 97 done 98 99 log_must cleanup 100done 101 102log_pass "find files which have no attrabute files with -xattr passed." 103