From owner-freebsd-fs@FreeBSD.ORG Fri Aug 24 01:15:31 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 DD798106564A for ; Fri, 24 Aug 2012 01:15:31 +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 BBF248FC15 for ; Fri, 24 Aug 2012 01:15:31 +0000 (UTC) Received: from exhub01.exchhosting.com (192.168.11.213) by exhub07.exchhosting.com (192.168.11.103) with Microsoft SMTP Server (TLS) id 8.3.213.0; Thu, 23 Aug 2012 18:15:25 -0700 Received: from localhost (35.8.247.10) by exchange.liveoffice.com (192.168.11.213) with Microsoft SMTP Server id 8.3.213.0; Thu, 23 Aug 2012 18:15:24 -0700 Date: Thu, 23 Aug 2012 21:15:17 -0400 From: Trent Nelson To: Message-ID: <20120824011517.GJ42732@snakebite.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="3V7upXqbjpZ4EhLz" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: 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 01:15:32 -0000 --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline 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. --3V7upXqbjpZ4EhLz--