Print this page
7290 ZFS test suite needs to control what utilities it can run
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/test/zfs-tests/tests/functional/xattr/xattr_008_pos.ksh
          +++ new/usr/src/test/zfs-tests/tests/functional/xattr/xattr_008_pos.ksh
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17  # fields enclosed by brackets "[]" replaced with your own identifying
  18   18  # information: Portions Copyright [yyyy] [name of copyright owner]
  19   19  #
  20   20  # CDDL HEADER END
  21   21  #
  22   22  # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23   23  # Use is subject to license terms.
  24   24  #
  25   25  
  26   26  #
  27      -# Copyright (c) 2013 by Delphix. All rights reserved.
       27 +# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
  28   28  #
  29   29  
  30   30  . $STF_SUITE/include/libtest.shlib
  31   31  . $STF_SUITE/tests/functional/xattr/xattr_common.kshlib
  32   32  
  33   33  #
  34   34  # DESCRIPTION:
  35   35  # We verify that the special . and .. dirs work as expected for xattrs.
  36   36  #
  37   37  # STRATEGY:
  38   38  #       1. Create a file and an xattr on that file
  39   39  #       2. List the . directory, verifying the output
  40   40  #       3. Verify we're unable to list the ../ directory
  41   41  #
  42   42  
  43   43  function cleanup {
  44   44          typeset file
  45   45  
  46   46          for file in /tmp/output.$$ /tmp/expected-output.$$ \
  47   47                  $TESTDIR/myfile.$$ ; do
  48      -                log_must $RM -f $file
       48 +                log_must rm -f $file
  49   49          done
  50   50  }
  51   51  
  52   52  log_assert "special . and .. dirs work as expected for xattrs"
  53   53  log_onexit cleanup
  54   54  
  55   55  # create a file, and an xattr on it
  56      -log_must $TOUCH $TESTDIR/myfile.$$
       56 +log_must touch $TESTDIR/myfile.$$
  57   57  create_xattr $TESTDIR/myfile.$$ passwd /etc/passwd
  58   58  
  59   59  # listing the directory .
  60      -log_must eval "$RUNAT $TESTDIR/myfile.$$ $LS  . > /tmp/output.$$"
       60 +log_must eval "runat $TESTDIR/myfile.$$ ls  . > /tmp/output.$$"
  61   61  create_expected_output  /tmp/expected-output.$$  \
  62   62      SUNWattr_ro  SUNWattr_rw  passwd
  63      -log_must $DIFF /tmp/output.$$ /tmp/expected-output.$$
       63 +log_must diff /tmp/output.$$ /tmp/expected-output.$$
  64   64  # list the directory . long form
  65      -log_must eval "$RUNAT $TESTDIR/myfile.$$ $LS -a . > /tmp/output.$$"
       65 +log_must eval "runat $TESTDIR/myfile.$$ ls -a . > /tmp/output.$$"
  66   66  create_expected_output  /tmp/expected-output.$$ . ..  \
  67   67      SUNWattr_ro  SUNWattr_rw  passwd
  68      -log_must $DIFF /tmp/output.$$ /tmp/expected-output.$$
       68 +log_must diff /tmp/output.$$ /tmp/expected-output.$$
  69   69  
  70   70  # list the directory .. expecting one file
  71      -OUTPUT=$($RUNAT $TESTDIR/myfile.$$ $LS ..)
       71 +OUTPUT=$(runat $TESTDIR/myfile.$$ ls ..)
  72   72  if [ "$OUTPUT" != ".." ]
  73   73  then
  74   74          log_fail "Listing the .. directory doesn't show \"..\" as expected."
  75   75  fi
  76   76  
  77   77  # verify we can't list ../
  78      -log_mustnot eval "$RUNAT $TESTDIR/myfile.$$ $LS ../ > /dev/null 2>&1"
       78 +log_mustnot eval "runat $TESTDIR/myfile.$$ ls ../ > /dev/null 2>&1"
  79   79  
  80   80  log_pass "special . and .. dirs work as expected for xattrs"
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX