From owner-svn-src-all@FreeBSD.ORG Tue Aug 17 06:08:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41E5610656A3; Tue, 17 Aug 2010 06:08:10 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30A8F8FC08; Tue, 17 Aug 2010 06:08:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7H68Auv020512; Tue, 17 Aug 2010 06:08:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7H68ArB020505; Tue, 17 Aug 2010 06:08:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008170608.o7H68ArB020505@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 17 Aug 2010 06:08:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211410 - head/tools/regression/pjdfstest/tests/chown X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2010 06:08:10 -0000 Author: pjd Date: Tue Aug 17 06:08:09 2010 New Revision: 211410 URL: http://svn.freebsd.org/changeset/base/211410 Log: More tests, especially for lchown(2). Modified: head/tools/regression/pjdfstest/tests/chown/01.t head/tools/regression/pjdfstest/tests/chown/04.t head/tools/regression/pjdfstest/tests/chown/05.t head/tools/regression/pjdfstest/tests/chown/06.t head/tools/regression/pjdfstest/tests/chown/07.t head/tools/regression/pjdfstest/tests/chown/10.t Modified: head/tools/regression/pjdfstest/tests/chown/01.t ============================================================================== --- head/tools/regression/pjdfstest/tests/chown/01.t Tue Aug 17 02:50:12 2010 (r211409) +++ head/tools/regression/pjdfstest/tests/chown/01.t Tue Aug 17 06:08:09 2010 (r211410) @@ -6,7 +6,7 @@ desc="chown returns ENOTDIR if a compone dir=`dirname $0` . ${dir}/../misc.sh -echo "1..5" +echo "1..6" n0=`namegen` n1=`namegen` @@ -14,5 +14,6 @@ n1=`namegen` expect 0 mkdir ${n0} 0755 expect 0 create ${n0}/${n1} 0644 expect ENOTDIR chown ${n0}/${n1}/test 65534 65534 +expect ENOTDIR lchown ${n0}/${n1}/test 65534 65534 expect 0 unlink ${n0}/${n1} expect 0 rmdir ${n0} Modified: head/tools/regression/pjdfstest/tests/chown/04.t ============================================================================== --- head/tools/regression/pjdfstest/tests/chown/04.t Tue Aug 17 02:50:12 2010 (r211409) +++ head/tools/regression/pjdfstest/tests/chown/04.t Tue Aug 17 06:08:09 2010 (r211410) @@ -6,12 +6,18 @@ desc="chown returns ENOENT if the named dir=`dirname $0` . ${dir}/../misc.sh -echo "1..4" +echo "1..9" n0=`namegen` n1=`namegen` +n2=`namegen` expect 0 mkdir ${n0} 0755 expect ENOENT chown ${n0}/${n1}/test 65534 65534 expect ENOENT chown ${n0}/${n1} 65534 65534 +expect ENOENT lchown ${n0}/${n1}/test 65534 65534 +expect ENOENT lchown ${n0}/${n1} 65534 65534 +expect 0 symlink ${n2} ${n0}/${n1} +expect ENOENT chown ${n0}/${n1} 65534 65534 +expect 0 unlink ${n0}/${n1} expect 0 rmdir ${n0} Modified: head/tools/regression/pjdfstest/tests/chown/05.t ============================================================================== --- head/tools/regression/pjdfstest/tests/chown/05.t Tue Aug 17 02:50:12 2010 (r211409) +++ head/tools/regression/pjdfstest/tests/chown/05.t Tue Aug 17 06:08:09 2010 (r211410) @@ -6,7 +6,7 @@ desc="chown returns EACCES when search p dir=`dirname $0` . ${dir}/../misc.sh -echo "1..15" +echo "1..18" n0=`namegen` n1=`namegen` @@ -22,11 +22,14 @@ expect 0 -u 65534 -g 65533,65534 -- chow expect 65534,65533 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid expect 0 chmod ${n1} 0644 expect EACCES -u 65534 -g 65533,65534 -- chown ${n1}/${n2} -1 65534 +expect EACCES -u 65534 -g 65533,65534 -- lchown ${n1}/${n2} -1 65534 expect 0 chmod ${n1} 0755 expect 65534,65533 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid expect 0 -u 65534 -g 65533,65534 -- chown ${n1}/${n2} -1 65534 expect 65534,65534 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} +expect 0 -u 65534 -g 65533,65534 -- lchown ${n1}/${n2} -1 65533 +expect 65534,65533 -u 65534 -g 65533 stat ${n1}/${n2} uid,gid +expect 0 unlink ${n1}/${n2} expect 0 rmdir ${n1} cd ${cdir} expect 0 rmdir ${n0} Modified: head/tools/regression/pjdfstest/tests/chown/06.t ============================================================================== --- head/tools/regression/pjdfstest/tests/chown/06.t Tue Aug 17 02:50:12 2010 (r211409) +++ head/tools/regression/pjdfstest/tests/chown/06.t Tue Aug 17 06:08:09 2010 (r211410) @@ -6,14 +6,18 @@ desc="chown returns ELOOP if too many sy dir=`dirname $0` . ${dir}/../misc.sh -echo "1..6" +echo "1..10" n0=`namegen` n1=`namegen` expect 0 symlink ${n0} ${n1} expect 0 symlink ${n1} ${n0} +expect ELOOP chown ${n0} 65534 65534 +expect ELOOP chown ${n1} 65534 65534 expect ELOOP chown ${n0}/test 65534 65534 expect ELOOP chown ${n1}/test 65534 65534 +expect ELOOP lchown ${n0}/test 65534 65534 +expect ELOOP lchown ${n1}/test 65534 65534 expect 0 unlink ${n0} expect 0 unlink ${n1} Modified: head/tools/regression/pjdfstest/tests/chown/07.t ============================================================================== --- head/tools/regression/pjdfstest/tests/chown/07.t Tue Aug 17 02:50:12 2010 (r211409) +++ head/tools/regression/pjdfstest/tests/chown/07.t Tue Aug 17 06:08:09 2010 (r211410) @@ -6,23 +6,48 @@ desc="chown returns EPERM if the operati dir=`dirname $0` . ${dir}/../misc.sh -echo "1..11" +echo "1..132" n0=`namegen` n1=`namegen` n2=`namegen` +n3=`namegen` expect 0 mkdir ${n0} 0755 cdir=`pwd` cd ${n0} expect 0 mkdir ${n1} 0755 expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644 -expect EPERM -u 65534 -g 65534 chown ${n1}/${n2} 65533 65533 -expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65534 65534 -expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65533 65533 -expect EPERM -u 65534 -g 65534 -- chown ${n1}/${n2} -1 65533 -expect 0 unlink ${n1}/${n2} +for type in regular dir fifo block char socket symlink; do + if [ "${type}" != "symlink" ]; then + create_file ${type} ${n1}/${n2} 65534 65534 + expect EPERM -u 65534 -g 65534 chown ${n1}/${n2} 65533 65533 + expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65534 65534 + expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65533 65533 + expect EPERM -u 65534 -g 65534 -- chown ${n1}/${n2} -1 65533 + expect 0 -u 65534 -g 65534 symlink ${n2} ${n1}/${n3} + expect EPERM -u 65534 -g 65534 chown ${n1}/${n3} 65533 65533 + expect EPERM -u 65533 -g 65533 chown ${n1}/${n3} 65534 65534 + expect EPERM -u 65533 -g 65533 chown ${n1}/${n3} 65533 65533 + expect EPERM -u 65534 -g 65534 -- chown ${n1}/${n3} -1 65533 + expect 0 unlink ${n1}/${n3} + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1}/${n2} + else + expect 0 unlink ${n1}/${n2} + fi + fi + create_file ${type} ${n1}/${n2} 65534 65534 + expect EPERM -u 65534 -g 65534 lchown ${n1}/${n2} 65533 65533 + expect EPERM -u 65533 -g 65533 lchown ${n1}/${n2} 65534 65534 + expect EPERM -u 65533 -g 65533 lchown ${n1}/${n2} 65533 65533 + expect EPERM -u 65534 -g 65534 -- lchown ${n1}/${n2} -1 65533 + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1}/${n2} + else + expect 0 unlink ${n1}/${n2} + fi +done expect 0 rmdir ${n1} cd ${cdir} expect 0 rmdir ${n0} Modified: head/tools/regression/pjdfstest/tests/chown/10.t ============================================================================== --- head/tools/regression/pjdfstest/tests/chown/10.t Tue Aug 17 02:50:12 2010 (r211409) +++ head/tools/regression/pjdfstest/tests/chown/10.t Tue Aug 17 06:08:09 2010 (r211410) @@ -6,7 +6,9 @@ desc="chown returns EFAULT if the path a dir=`dirname $0` . ${dir}/../misc.sh -echo "1..2" +echo "1..4" expect EFAULT chown NULL 65534 65534 expect EFAULT chown DEADCODE 65534 65534 +expect EFAULT lchown NULL 65534 65534 +expect EFAULT lchown DEADCODE 65534 65534