From owner-freebsd-fs@FreeBSD.ORG Fri Aug 24 07:43:12 2012 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88C2B106566B for ; Fri, 24 Aug 2012 07:43:12 +0000 (UTC) (envelope-from trent@snakebite.org) Received: from exchange.liveoffice.com (exchla3.liveoffice.com [64.70.67.188]) by mx1.freebsd.org (Postfix) with ESMTP id 5F4008FC08 for ; Fri, 24 Aug 2012 07:43:12 +0000 (UTC) Received: from EXHUB02.exchhosting.com (192.168.11.214) by exhub06.exchhosting.com (192.168.11.102) with Microsoft SMTP Server (TLS) id 8.3.213.0; Fri, 24 Aug 2012 00:43:11 -0700 Received: from localhost (35.8.247.10) by exchange.liveoffice.com (192.168.11.214) with Microsoft SMTP Server id 8.3.213.0; Fri, 24 Aug 2012 00:43:10 -0700 Date: Fri, 24 Aug 2012 03:43:10 -0400 From: Trent Nelson To: "freebsd-fs@freebsd.org" Message-ID: <20120824074309.GC93736@snakebite.org> References: <20120824011517.GJ42732@snakebite.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20120824011517.GJ42732@snakebite.org> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: chmod -h 000x against symlink has bizarre results on ZFS X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Aug 2012 07:43:12 -0000 On Thu, Aug 23, 2012 at 06:15:17PM -0700, Trent Nelson wrote: > Here's the output from the attached test_readlink.sh, also available > at http://bugs.python.org/file26979/test_readlink.sh: Looks like the attachment got stripped. I've pasted it below. Trent. -- test_readlink.sh -- #!/bin/sh # If /tmp isn't backed by a ZFS file system, change it to something that is. _base=/tmp if [ -z "$(zfs list -H -o mountpoint | grep ^$_base)" ]; then echo error: \'$_base\' is not backed by ZFS exit 1 fi _python=$(which python 2> /dev/null) _test() { local _file _symlink _py _file=$1 _mode=$2 if [ -z "$_mode" ]; then _mode=0007 fi _symlink=$_file.lnk _py="import os; print(repr(os.readlink('$_symlink')))" rm -rf $_file $_symlink echo file > $_file ln -s $_file $_symlink echo before chmod -h $_mode: ls -l $_file | awk '{ print $1 " " $9 };' ls -l $_symlink | awk '{ print $1 " " $9 $10 $11 };' if [ -f "$_python" ]; then echo "python os.readlink($_symlink): " eval "$_python" -c \""$_py"\" fi chmod -h $_mode $_symlink echo after chmod -h $_mode: ls -l $_file | awk '{ print $1 " " $9 };' ls -l $_symlink | awk '{ print $1 " " $9 $10 $11 };' if [ -f "$_python" ]; then echo "python os.readlink($_symlink): " eval "$_python" -c \""$_py"\" fi } _quick_test() { local _file _symlink _file=$1 _mode=$2 if [ -z "$_mode" ]; then _mode=0007 fi _symlink=$_file.lnk rm -rf $_file $_symlink echo file > $_file ln -s $_file $_symlink chmod -h $_mode $_symlink echo after chmod -h $_mode: ls -l $_symlink | awk '{ print $1 " " $9 $10 $11 };' } echo echo "****** TEST 1: link/target length less than 24 ******" _test $_base/lt24 echo " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" echo "target is padded out with NULLs to 24" echo; echo for _ in 1 2 ; do echo; done echo "****** TEST 2: link/target length longer than 24 ******" _test $_base/definitelywaylongerthantwentyfour echo " ^^^^^^^^^^^^^^^^^^^^^^^^" echo "target gets truncated to 24" echo; echo echo echo "****** Other modes... ******" _quick_test $_base/definitelywaylongerthantwentyfour 0006 _quick_test $_base/definitelywaylongerthantwentyfour 0005 _quick_test $_base/definitelywaylongerthantwentyfour 0004 _quick_test $_base/definitelywaylongerthantwentyfour 0000 echo; echo # vim:set ts=8 sw=4 sts=4 tw=78 et: