Date: Thu, 23 Aug 2012 21:15:17 -0400 From: Trent Nelson <trent@snakebite.org> To: <freebsd-fs@freebsd.org> Subject: chmod -h 000x against symlink has bizarre results on ZFS Message-ID: <20120824011517.GJ42732@snakebite.org>
index | next in thread | raw e-mail
Hi folks,
I recently set up a FreeBSD build slave for the Python project,
and noticed some symlink tests were failing in a very strange way
(http://bugs.python.org/issue15748).
When chmod -h 000x is done against a file/link of length less than
24, the target seems to get padded out to 24 with 0s. If it's
longer than 24, it'll get truncated. 'x' can be 7, 6, 5 or 4 and
the behaviour is the same.
Here's the output from the attached test_readlink.sh, also available
at http://bugs.python.org/file26979/test_readlink.sh:
% ./test_readlink.sh
****** TEST 1: link/target length less than 24 ******
before chmod -h 0007:
-rw-r----- /tmp/lt24
lrwxr-x--- /tmp/lt24.lnk->/tmp/lt24
python os.readlink(/tmp/lt24.lnk):
'/tmp/lt24'
after chmod -h 0007:
-rw-r----- /tmp/lt24
l------rwx /tmp/lt24.lnk->/tmp/lt24
python os.readlink(/tmp/lt24.lnk):
'/tmp/lt24\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
target is padded out with NULLs to 24
****** TEST 2: link/target length longer than 24 ******
before chmod -h 0007:
-rw-r----- /tmp/definitelywaylongerthantwentyfour
lrwxr-x---
/tmp/definitelywaylongerthantwentyfour.lnk->/tmp/definitelywaylongerthantwentyfour
python os.readlink(/tmp/definitelywaylongerthantwentyfour.lnk):
'/tmp/definitelywaylongerthantwentyfour'
after chmod -h 0007:
-rw-r----- /tmp/definitelywaylongerthantwentyfour
l------rwx
/tmp/definitelywaylongerthantwentyfour.lnk->/tmp/definitelywaylonger
python os.readlink(/tmp/definitelywaylongerthantwentyfour.lnk):
'/tmp/definitelywaylonger'
^^^^^^^^^^^^^^^^^^^^^^^^
target gets truncated to 24
****** Other modes... ******
after chmod -h 0006:
l------rw-
/tmp/definitelywaylongerthantwentyfour.lnk->/tmp/definitelywaylonger
after chmod -h 0005:
l------r-x
/tmp/definitelywaylongerthantwentyfour.lnk->/tmp/definitelywaylonger
after chmod -h 0004:
l------r--
/tmp/definitelywaylongerthantwentyfour.lnk->/tmp/definitelywaylonger
after chmod -h 0000:
l---------
/tmp/definitelywaylongerthantwentyfour.lnk->/tmp/definitelywaylongerthantwentyfour
This only happens on ZFS. I'm on v28, don't have any v15s lying
around.
I'm perplexed. Can others reproduce it?
Regards,
Trent.
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120824011517.GJ42732>
