Date: Fri, 24 Aug 2012 03:43:10 -0400 From: Trent Nelson <trent@snakebite.org> To: "freebsd-fs@freebsd.org" <freebsd-fs@freebsd.org> Subject: Re: chmod -h 000x against symlink has bizarre results on ZFS Message-ID: <20120824074309.GC93736@snakebite.org> In-Reply-To: <20120824011517.GJ42732@snakebite.org> References: <20120824011517.GJ42732@snakebite.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120824074309.GC93736>