From unknown Sat Jun 21 03:22:57 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#29788 <29788@debbugs.gnu.org> To: bug#29788 <29788@debbugs.gnu.org> Subject: Status: chown: recursive operation with "-H" flag does not work as documented Reply-To: bug#29788 <29788@debbugs.gnu.org> Date: Sat, 21 Jun 2025 10:22:57 +0000 retitle 29788 chown: recursive operation with "-H" flag does not work as do= cumented reassign 29788 coreutils submitter 29788 Michael Orlitzky severity 29788 normal tag 29788 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 20 13:30:42 2017 Received: (at submit) by debbugs.gnu.org; 20 Dec 2017 18:30:42 +0000 Received: from localhost ([127.0.0.1]:44704 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRj8c-00017K-GL for submit@debbugs.gnu.org; Wed, 20 Dec 2017 13:30:42 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40781) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRj8Z-000177-65 for submit@debbugs.gnu.org; Wed, 20 Dec 2017 13:30:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRj8T-0000rA-2x for submit@debbugs.gnu.org; Wed, 20 Dec 2017 13:30:33 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:38319) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eRj8S-0000r2-Vg for submit@debbugs.gnu.org; Wed, 20 Dec 2017 13:30:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRj8R-0001rz-N9 for bug-coreutils@gnu.org; Wed, 20 Dec 2017 13:30:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRj8O-0000oQ-G9 for bug-coreutils@gnu.org; Wed, 20 Dec 2017 13:30:31 -0500 Received: from mail2.viabit.com ([65.246.80.16]:58446) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eRj8O-0000mz-CR for bug-coreutils@gnu.org; Wed, 20 Dec 2017 13:30:28 -0500 Received: from [172.17.29.2] (vpn1.metro-data.com [65.213.236.242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail2.viabit.com (Postfix) with ESMTPSA id 3z237z6qMQz40tB for ; Wed, 20 Dec 2017 13:24:15 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=orlitzky.com; s=mail2; t=1513794256; bh=b0/X5nJ1hyV/Vtbtst4+ylfzg2qIdR0s2MeLB0TVMPQ=; h=To:From:Subject:Date; b=gUP4oixrvj2iz8VaJR2Sb74isFKjNg525tK56zxRNt2iiE59CevVI0ANdBHgdwFs6 T8T9oC2tUnQviZ3KKkIEJ6+bTSZQGf0RfcHRhUQaGDI+5x5CIOy14HPbXRbDOIPXWy P4JlWHHYxvZ4REIxBAi56XpiyuKCZUnFws/dsa+M= To: bug-coreutils@gnu.org From: Michael Orlitzky Subject: chown: recursive operation with "-H" flag does not work as documented Message-ID: <41760c8f-a85f-d340-b0ae-3ca06d2e59d5@orlitzky.com> Date: Wed, 20 Dec 2017 13:24:14 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) The documentation for the "-H" flag to chown says, The following options modify how a hierarchy is traversed when the -R option is also specified. If more than one is specified, only the final one takes effect. -H if a command line argument is a symbolic link to a directory, traverse it This is not doing what I think it should do. In a terminal, as my "mjo" system user, I can run, $ mkdir foo $ mkdir bar $ ln -s ../bar foo/baz $ sudo chown --verbose --recursive -H root foo which outputs... changed ownership of 'foo/baz' from mjo to root changed ownership of 'foo' from mjo to root However, the path "foo/baz" was not passed on the command-line, and chown did in fact follow the symlink, $ ls -l | grep bar drwxr-xr-x 2 root mjo 4.0K 2017-12-20 13:19 bar as evidenced by the fact that "bar" was created as mjo:mjo. From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 20 15:59:16 2017 Received: (at control) by debbugs.gnu.org; 20 Dec 2017 20:59:16 +0000 Received: from localhost ([127.0.0.1]:44851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRlSO-0000UA-8R for submit@debbugs.gnu.org; Wed, 20 Dec 2017 15:59:16 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:50980) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRlSN-0000Tv-2g; Wed, 20 Dec 2017 15:59:15 -0500 Received: from [192.168.101.10] ([91.12.175.109]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.183]) with ESMTPSA (Nemesis) id 0LcnP5-1essTc1bfj-00k5vI; Wed, 20 Dec 2017 21:58:59 +0100 Subject: Re: bug#29788: chown: recursive operation with "-H" flag does not work as documented To: Michael Orlitzky , 29788-done@debbugs.gnu.org References: <41760c8f-a85f-d340-b0ae-3ca06d2e59d5@orlitzky.com> From: Bernhard Voelker Message-ID: <2b3abf4b-9529-482d-cc48-7c17c7d906bc@bernhard-voelker.de> Date: Wed, 20 Dec 2017 21:58:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <41760c8f-a85f-d340-b0ae-3ca06d2e59d5@orlitzky.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:GQlzHN5TgRI0rWLwHryeLY5qC/bPR5uCuPi8OriswDNlXNUA3+u uHoOHJuFUBXllxrK9wYtL4/Kn9ABR85R5xExEfAr5ExuhV/x4PnZWoCVMYRtqHrnWfyEaKh YWqB3+dCw9VvSpwbxRtDKeg4qzAsYmdyCOcu6VeAGLKZ1qtN1I3JgcTmcIBfj2TyC5XDvn1 5d7ptR49e8kHkM1nlQoXg== X-UI-Out-Filterresults: notjunk:1;V01:K0:qLgo4V6pR40=:FIwkrFC2G/6wQEJAAoOtMa JxCWg3oHEQuXMnyb5/8Fd2w6CzGwTBbC9WGbRzMVKb67Eu7TT2YdvfFhh4oguFzbi9GJogwCQ 8GfG/yDc2v48n9P8Dcy/UzYTn4Coozu/bzN5usQGSXmqHGBGL0C9Yug5NCkRME4J9fXQtMHE3 dTyGBQHOI5UeRLLAzyawsV6kz1xrz/99/5QEOujBajRUh24q5UkhpCuWRc7cL6M37K8XUPjJ6 hB+c7HTs7UQYXIO2MuEZYgWvwYGzpzk9oI1IR4nRCg0rVQZuIB5s0o28JQtHYZwNOKvLzQlLr JicMLsaDTEnbYS1hUQlLNDO5dA6xHnlCPx9FoIpeDz9UX8lakFxU8w3ddGoCxN+JBNjT+lCH+ 8K4zqtZSzOnjLWmWu0qu4R1Dc1O4JAh0z1L+e+lLfCmilMMRY0GDD0E+5P7+LKrHrLx+SyZKJ 5cBRwXaL2YwsafL8dDSgT3RDbQb6qNVzhlOHvJg1A27NYM1msxCpEGePidNWq0n3fazzAU79w IBcLG2W/RYkH3SCKWfU8tHgD3I0xFjLu12KX22jpUHeJGaPGeMqzuIE43ZK4GCAW67QuDpRgX EmUJx6c6NiIkcKaxUznaVyBEP4Y1f7++luvPo2S5PRxKvL3gax3rzti+x5nYAh/eQSoyYvuIt je6CSSEYm3q7gXR+C4VBs40AAU/TnOkg3qn/Ee6Uum3DLEJg+15Zb2Par8+VmYe75oNyMO3YH BHhoTYg5zuOUTyQlsd+kqwKcXFLHolx83S10MaG+pq3PH0tEB44SFDE924c= X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) tag 29788 notabug stop On 12/20/2017 07:24 PM, Michael Orlitzky wrote: > The documentation for the "-H" flag to chown says, > > The following options modify how a hierarchy is traversed when the > -R option is also specified. If more than one is specified, only > the final one takes effect. > > -H if a command line argument is a symbolic link to a directory, > traverse it > > This is not doing what I think it should do. In a terminal, as my "mjo" > system user, I can run, > > $ mkdir foo > $ mkdir bar > $ ln -s ../bar foo/baz > $ sudo chown --verbose --recursive -H root foo > > which outputs... > > changed ownership of 'foo/baz' from mjo to root > changed ownership of 'foo' from mjo to root > > However, the path "foo/baz" was not passed on the command-line, and > chown did in fact follow the symlink, > > $ ls -l | grep bar > drwxr-xr-x 2 root mjo 4.0K 2017-12-20 13:19 bar > > as evidenced by the fact that "bar" was created as mjo:mjo. I think there is something else going on you didn't consider: --dereference affect the referent of each symbolic link (this is the default), rather than the symbolic link itself The -H option does not affect 'foo/baz' (or the target it references), but only the command line arg 'foo'. So the test case for -H is: $ mkdir bar bar/baz $ ln -s bar foo $ sudo chown --verbose --recursive -H root foo changed ownership of 'foo/baz' from berny to root changed ownership of 'foo' from berny to root $ find . -ls 4014266 4 drwxr-xr-x 3 berny users 4096 Dec 20 21:50 . 4014269 4 drwxr-xr-x 3 root users 4096 Dec 20 21:50 ./bar 4014271 4 drwxr-xr-x 2 root users 4096 Dec 20 21:50 ./bar/baz 4014272 0 lrwxrwxrwx 1 berny users 3 Dec 20 21:50 ./foo -> bar Without -H, chown would not dereference 'foo', and change the ownership of the symlink (on systems which support this): $ sudo chown --verbose --recursive root foo changed ownership of 'foo' from berny to root $ find . -ls 4014266 4 drwxr-xr-x 3 berny users 4096 Dec 20 21:51 . 4014269 4 drwxr-xr-x 3 berny users 4096 Dec 20 21:51 ./bar 4014271 4 drwxr-xr-x 2 berny users 4096 Dec 20 21:51 ./bar/baz 4014272 0 lrwxrwxrwx 1 root users 3 Dec 20 21:51 ./foo -> bar Thus, I think this not a bug in chmod or the documentation, but in the your expectations. Therefore, I'm marking this as not-a-bug in our bug tracker. Of course, you are welcome to continue the discussion, and if needed we can reopen this issue at a later point. Have a nice day, Berny From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 20 16:27:07 2017 Received: (at 29788-done) by debbugs.gnu.org; 20 Dec 2017 21:27:07 +0000 Received: from localhost ([127.0.0.1]:44871 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRltJ-00036Y-UL for submit@debbugs.gnu.org; Wed, 20 Dec 2017 16:27:06 -0500 Received: from mail2.viabit.com ([65.246.80.16]:45684) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRltI-000363-42 for 29788-done@debbugs.gnu.org; Wed, 20 Dec 2017 16:27:04 -0500 Received: from [172.17.29.2] (vpn1.metro-data.com [65.213.236.242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail2.viabit.com (Postfix) with ESMTPSA id 3z27Bn4p70z40t8 for <29788-done@debbugs.gnu.org>; Wed, 20 Dec 2017 16:26:57 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=orlitzky.com; s=mail2; t=1513805217; bh=NBsq8DsogieKhcmsTOrnxp9OurCQY/r10fjRc8JxREs=; h=Subject:To:References:From:Date:In-Reply-To; b=x4sxM2hn+H52K9ytxkRm+QxIDmpZn/7FFe1MsaSE6EDAFZQ7cEN6K0tuovHriXhTL 1L+saMm+szKbShTUqCvLEuiY7jTiRhdfOoxv2aIWETxSLdibGlwPS78buT6JfjbnKR 0g57gUg/jzr678mso44vSYGBlICIpZnVz+cqRVzs= Subject: Re: bug#29788: chown: recursive operation with "-H" flag does not work as documented To: 29788-done@debbugs.gnu.org References: <41760c8f-a85f-d340-b0ae-3ca06d2e59d5@orlitzky.com> <2b3abf4b-9529-482d-cc48-7c17c7d906bc@bernhard-voelker.de> From: Michael Orlitzky Message-ID: <6ceea7f4-821b-6c12-e9a8-96ce0b07d592@orlitzky.com> Date: Wed, 20 Dec 2017 16:26:56 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <2b3abf4b-9529-482d-cc48-7c17c7d906bc@bernhard-voelker.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 29788-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On 12/20/2017 03:58 PM, Bernhard Voelker wrote: > > I think there is something else going on you didn't consider: > > --dereference affect the referent of each symbolic link (this is > the default), rather than the symbolic link itself > > ... > > Thus, I think this not a bug in chmod or the documentation, but in the > your expectations. Therefore, I'm marking this as not-a-bug in our bug > tracker. Of course, you are welcome to continue the discussion, and if > needed we can reopen this issue at a later point. > Thank you, you might be right. To explain how I wound up in this situation, what I was actually running was, $ chown --recursive --dereference root foo which emits an error: chown: -R --dereference requires either -H or -L At that point, I consulted the documentation to see how "-H" and "-L" differ: -H if a command line argument is a symbolic link to a directory, traverse it -L traverse every symbolic link to a directory encountered By way of omission I expected -H not to follow directory symlinks that weren't explicitly passed, but I can see how the interpretation could go either way. The choice of "-H" or "-L" adds to the "--dereference" option, whereas I thought it was asking me to choose (only) one of the two modes of operation. Thanks for your time. From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 20 16:52:32 2017 Received: (at 29788) by debbugs.gnu.org; 20 Dec 2017 21:52:32 +0000 Received: from localhost ([127.0.0.1]:44896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRmHv-0003wJ-Ql for submit@debbugs.gnu.org; Wed, 20 Dec 2017 16:52:32 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:41718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRmHt-0003w6-22 for 29788@debbugs.gnu.org; Wed, 20 Dec 2017 16:52:30 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id DBA5A16154A; Wed, 20 Dec 2017 13:52:21 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id lPwLnUeRiEPO; Wed, 20 Dec 2017 13:52:21 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id F23ED16154B; Wed, 20 Dec 2017 13:52:20 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id rwQai8w7FWcz; Wed, 20 Dec 2017 13:52:20 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id D453B161549; Wed, 20 Dec 2017 13:52:20 -0800 (PST) Subject: Re: bug#29788: chown: recursive operation with "-H" flag does not work as documented To: 29788@debbugs.gnu.org, mail@bernhard-voelker.de, michael@orlitzky.com References: <41760c8f-a85f-d340-b0ae-3ca06d2e59d5@orlitzky.com> <2b3abf4b-9529-482d-cc48-7c17c7d906bc@bernhard-voelker.de> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <1034046d-c54f-fb1f-f6b7-b91abb3d486e@cs.ucla.edu> Date: Wed, 20 Dec 2017 13:52:17 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <2b3abf4b-9529-482d-cc48-7c17c7d906bc@bernhard-voelker.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 29788 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On 12/20/2017 12:58 PM, Bernhard Voelker wrote: > Thus, I think this not a bug in chmod or the documentation, but in the > your expectations. I think his expectations are what POSIX requires. For chown -H -R, POSIX says that if "a symbolic link referencing a file of type directory is specified on the command line, /chown/ shall change the user ID (and group ID, if specified) of the directory referenced by the symbolic link and all files in the file hierarchy below it." The clear implication in context is that -H should mean --dereference at the top level, and --no-dereference at lower levels. Which is pretty much what he was expecting. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/chown.html Admittedly the POSIX spec is not that easy to understand here. From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 20 18:08:16 2017 Received: (at 29788) by debbugs.gnu.org; 20 Dec 2017 23:08:16 +0000 Received: from localhost ([127.0.0.1]:44934 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRnTD-0005hq-Uf for submit@debbugs.gnu.org; Wed, 20 Dec 2017 18:08:16 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:57898) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRnTC-0005hc-HX for 29788@debbugs.gnu.org; Wed, 20 Dec 2017 18:08:14 -0500 Received: from [192.168.101.10] ([91.12.175.109]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MaU9p-1ehONJ3Tez-00K8xj; Thu, 21 Dec 2017 00:07:48 +0100 Subject: Re: bug#29788: chown: recursive operation with "-H" flag does not work as documented To: Paul Eggert , 29788@debbugs.gnu.org, michael@orlitzky.com References: <41760c8f-a85f-d340-b0ae-3ca06d2e59d5@orlitzky.com> <2b3abf4b-9529-482d-cc48-7c17c7d906bc@bernhard-voelker.de> <1034046d-c54f-fb1f-f6b7-b91abb3d486e@cs.ucla.edu> From: Bernhard Voelker Message-ID: Date: Thu, 21 Dec 2017 00:07:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <1034046d-c54f-fb1f-f6b7-b91abb3d486e@cs.ucla.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:xNKVFmRlJ5zyXO/6L+jOfx1bTiOFumQOnzdVCzlfbs2qXI9Do+1 qCeCBpkUOGvwIEH62oaUTn60xHDTMqlSiM6/75eNA1xXXdftJnpXDVLskYe8siGUtOb4zwP djp43ywc8CjxiVYTrsp/kErVALWocW4x3qiA09D0+P+sLX1RIHvTPJs6Zw46JngJbWCcCLt kK+OcLFHzVQNt9dkDWcgg== X-UI-Out-Filterresults: notjunk:1;V01:K0:a5BEKPDPGGo=:PQ/Ya/zgR8Lm2e6blqrV+x UieDdcLraF4fl4lhcA0GXIJqxm/aeAWJEMTYftwwuh6tF2jzTEy/kA8jo9nrw1ttDpSly1zxV f4HSlmRyjHKtIUfXgsyVgrqkuAgujeCeLdfZYYc+YRs/AMf8z5uzi+zrQZnvmGEoUkZD0L//h oYH+KThGmKvQSPeA6aMq72FmB8cGxmkKvPqEnKmaJXZsw3E/FOV+yQ8WuzEeU7jiad1cdCWcg dUOz6j4Z03gqUziYrXFvW7QB/tm87oeYgMtlWqsamkk3Gxmj1LQ4ygcL++Q2CMnapBaOjv/tn 9X8Ticw1Y3tixSBVkqhudgpqT7GrXg5/8pAfE8LdWE2XzVbhhVUadX3DU2PNx7n45e4i4Dvqr 1MiHebpAGaLont3ySgikUzqYfg77430DInNZw4pWstrQCvrt1hiHf3SaUNj9oQfHPJoWFcXip Qql/XvkadUjWadJUEztVm91llCeoi7MaH2eYF35tprEH7bo9HizlzmLa7q9u26a2jRYKpe44i DypGH41uC3rsfYEfKVXsq+RWp8eQrFfTyZAktC9ZllK7zuDQsnAjxEtJnZEI9VCM79vLBjOij aW4WrwHh5CdFwj/qx0usAhOHxMDUuF1RT9NzplZUt+0rWB1zUGJW/i/BG37rgLju8sMk/Upmu IaN9BWK1oeJ4jNXACk2fyf6h9dYzAXtcUPi3nIB3CU/5Rc5iYAphsQMlGo3SOby2LUPBaHX+x h7Zb4gPRw29ia7hZttXhHY/oRF58WDHooYnK31o16FmhfE/1IH3WdjrAScU= X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 29788 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) On 12/20/2017 10:52 PM, Paul Eggert wrote: > For chown -H -R, POSIX > says that if "a symbolic link referencing a file of type directory is > specified on the command line,/chown/ shall change the user ID (and > group ID, if specified) of the directory referenced by the symbolic link > and all files in the file hierarchy below it." The clear implication in > context is that -H should mean --dereference at the top level, [...] I agree here. > [...] and --no-dereference at lower levels. I read this different: --dereference is still the default in the OPs example 'chown -vRH root foo' as -h|--no-dereference was not explicitly passed. After all, I somehow have the feeling that the problem is two-fold: a) The ownership of which file is changed? The symlink or the target? b) Shall chown follow the symlink or not? Without a dedicated --follow|--no-follow, it will be impossible to satisfy all combinations of expected behavior. Anyway, it seems hard to choose the right combination without knowing if the command line argument is a symbolic link (and points to a valid and accessible directory or not) or another file type. Have a nice day, Berny From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 20 18:13:14 2017 Received: (at 29788) by debbugs.gnu.org; 20 Dec 2017 23:13:14 +0000 Received: from localhost ([127.0.0.1]:44950 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRnY0-0005qH-2s for submit@debbugs.gnu.org; Wed, 20 Dec 2017 18:13:12 -0500 Received: from mail2.viabit.com ([65.246.80.16]:50750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRnXy-0005q3-76 for 29788@debbugs.gnu.org; Wed, 20 Dec 2017 18:13:10 -0500 Received: from [172.17.29.2] (vpn1.metro-data.com [65.213.236.242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail2.viabit.com (Postfix) with ESMTPSA id 3z29YB2XT7z40sw for <29788@debbugs.gnu.org>; Wed, 20 Dec 2017 18:13:01 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=orlitzky.com; s=mail2; t=1513811582; bh=AwfTemqlKTeWE7PT/nnAOuJgXHpfXOejwdgSekUkYoI=; h=Subject:To:References:From:Date:In-Reply-To; b=XinZfFwLNIeUoTQEz/Y2CbrS8II7L/LVS42L9vG4W3VBVtmGWkJHim9ZG6pRAx99d UNdtBpJ57mhQvpVkgBiGcKG3i3iJK4ZhufpHQUuYzV5D8dAEBgWsQfDqciXaGTXOnc m4sT0Nkcm9y9dWf6epX2rcFKLJ/I5a9ZCTH8qjkM= Subject: Re: bug#29788: chown: recursive operation with "-H" flag does not work as documented To: 29788@debbugs.gnu.org References: <41760c8f-a85f-d340-b0ae-3ca06d2e59d5@orlitzky.com> <2b3abf4b-9529-482d-cc48-7c17c7d906bc@bernhard-voelker.de> <1034046d-c54f-fb1f-f6b7-b91abb3d486e@cs.ucla.edu> From: Michael Orlitzky Message-ID: Date: Wed, 20 Dec 2017 18:12:59 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <1034046d-c54f-fb1f-f6b7-b91abb3d486e@cs.ucla.edu> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 29788 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On 12/20/2017 04:52 PM, Paul Eggert wrote: > On 12/20/2017 12:58 PM, Bernhard Voelker wrote: >> Thus, I think this not a bug in chmod or the documentation, but in the >> your expectations. > > I think his expectations are what POSIX requires. For chown -H -R, POSIX > says that... This is where I started off, but POSIX doesn't say anything about the "--dereference" flag. When chown told me to pick either "-H" or "-L", I thought it was asking me to pick one mode of operation, either a) chown -R -L, or b) chown -R -H In fact, it was asking me to choose one of c) chown --dereference -R -L, or d) chown --dereference -R -H Should "chown --dereference" be equivalent to "chown"? If so, then chown --dereference -R -H = chown -R -H is specified by POSIX. At this point, you could talk me into either interpretation. From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 20 18:20:16 2017 Received: (at 29788-done) by debbugs.gnu.org; 20 Dec 2017 23:20:16 +0000 Received: from localhost ([127.0.0.1]:44957 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRnep-00060X-Rx for submit@debbugs.gnu.org; Wed, 20 Dec 2017 18:20:15 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:50701) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRnem-00060I-4U for 29788-done@debbugs.gnu.org; Wed, 20 Dec 2017 18:20:12 -0500 Received: from [192.168.101.10] ([91.12.175.109]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MD8Hs-1eDSiH2dRc-00GYPh; Thu, 21 Dec 2017 00:19:57 +0100 Subject: Re: bug#29788: chown: recursive operation with "-H" flag does not work as documented To: Michael Orlitzky , 29788-done@debbugs.gnu.org References: <41760c8f-a85f-d340-b0ae-3ca06d2e59d5@orlitzky.com> <2b3abf4b-9529-482d-cc48-7c17c7d906bc@bernhard-voelker.de> <6ceea7f4-821b-6c12-e9a8-96ce0b07d592@orlitzky.com> From: Bernhard Voelker Message-ID: <8a3c41f8-3f2d-678c-1428-2861b40b2a28@bernhard-voelker.de> Date: Thu, 21 Dec 2017 00:19:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <6ceea7f4-821b-6c12-e9a8-96ce0b07d592@orlitzky.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:XWrSl0CF3sr7ZySzrsLniit2Qszk6v6SwA6MOipVx6pJ1m0i72w tDrXcn1HTzowD21CtM2oAzcSp9nyJuog5JFP4y8gL8v54KGl043O0A5j/cff03K5dCIAyo9 ag9hrxytjR6PEMxB/jLldbn67JJbEiYxAnc+z0m0DHUnFVLVSwTC8nBj09to81LXJsjPEXC Bo5n+Wx3uPVZVWzjzf+Jg== X-UI-Out-Filterresults: notjunk:1;V01:K0:IYb0G2Lr40M=:5yTYhVPfg8Xfz8zq53LEhT V/VqeTj0yZe7F6BkoqJDGjHvxpkfngTjN3PvhSSFLCV9mBrsBmUYC6hWeo1HUIJxzjdSvBjvy WeaNP/r/Tgb715YlQ3wtdg3eIxCLRHD9VyyDKns6ARdns5EXp5yD3ukCc+PZ5OqiCp7LRekwa wvXQScp1wgedau+0sUztFF8mB1TYcBITwj+zfN6mC4H8QpyTNEVVj7RibelSlCkJUYrSTcvNL n0UJXSlKg34yYV1wLz/nB+bOu/Rf8aEq2IOmg9S+SRO1yzk/m0NukDJz99cBEZK86LBKHb2G0 fh0Dd02EkIfD+IifJXgS0CoMl4uW4J5XKQ0i1rj6pymA0ywMFpAHCH6Lnmwr6zvVxBh68rO8v OfRHO6d4Uk32JYq06AHtgB6JcKhei9zL3a9/n2FazQn0NFgrWRo+hYh4SKFfLGNz7dc652WGP mZn2NhPXqcQh2CkdKSQHhZdgf4oe2ro+fCEzeMtZIIXqx+iOrzshxK1tnVWf/9pIbOfPtVwTP FKizEe+/5TNuH5WtketallfL2eZr2EBZivc8a7Xgo37h7tkExCm0l19XkjPOgpbNd2BaPQLVL n8oz7SYSQnU4Xsd+VLaKeC4Luzswdh0uEL22HDbl+8nMtwJOY38APVCHFhsNZzRMJz37InpU5 QpbFxdqQliWCYHnZUajK1I2J0/RKUtAqr2jMrwDBmESyndd1yNsEo1hZU1sUNRsDa7ZzrsHhc dQRUNLxHiwESLGM6jGRE4uXLT8tUTKgFNSbwktpHCuBTeY5bH94Xz6loc3vW3INVkljjkZwxx bd+16Pj X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 29788-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) On 12/20/2017 10:26 PM, Michael Orlitzky wrote: > $ chown --recursive --dereference root foo > > which emits an error: > > chown: -R --dereference requires either -H or -L Hmm, this looks inconsistent as well: --dereference is the default if neither --dereference nor -h|--no-dereference are specified, but 'chown -R user dir' does not require -H or -L. chown(1) hasn't been changed regarding this behavior since 2006 (coreutils-6.8), so this is obviously a rare edge case. FWIW, the test-suite for chown lacks exactly that case. Have a nice day, Berny From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 21 11:58:30 2017 Received: (at 29788) by debbugs.gnu.org; 21 Dec 2017 16:58:30 +0000 Received: from localhost ([127.0.0.1]:46356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eS4Aw-00026Z-L3 for submit@debbugs.gnu.org; Thu, 21 Dec 2017 11:58:30 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:39322) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eS4Au-00026M-Ob for 29788@debbugs.gnu.org; Thu, 21 Dec 2017 11:58:29 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E3C09160FA1; Thu, 21 Dec 2017 08:58:22 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ZiEXch8OLJYx; Thu, 21 Dec 2017 08:58:22 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 29736161496; Thu, 21 Dec 2017 08:58:22 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id MDxcjHgL1RIv; Thu, 21 Dec 2017 08:58:22 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 11D44160FA1; Thu, 21 Dec 2017 08:58:22 -0800 (PST) Subject: Re: bug#29788: chown: recursive operation with "-H" flag does not work as documented To: Michael Orlitzky , 29788@debbugs.gnu.org References: <41760c8f-a85f-d340-b0ae-3ca06d2e59d5@orlitzky.com> <2b3abf4b-9529-482d-cc48-7c17c7d906bc@bernhard-voelker.de> <1034046d-c54f-fb1f-f6b7-b91abb3d486e@cs.ucla.edu> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <5fb5276f-05f5-7e3b-9199-4a3a9e53e0e8@cs.ucla.edu> Date: Thu, 21 Dec 2017 08:58:18 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 29788 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On 12/20/2017 03:12 PM, Michael Orlitzky wrote: > This is where I started off, but POSIX doesn't say anything about the > "--dereference" flag. Yes, well, a fundamental problem here is that POSIX is confused. The -H, -L, and -P options are clearly intended to control whether symlinks are followed, and the -h option is also intended to control the same thing, and POSIX doesn't say what happens when the two conflict. For example, 'chown -RHh symlink-to-dir' clearly conflicts (-L means command-line symlinks to directories are followed, whereas -h means they are not), and POSIX does not say how to resolve the conflict. The situation is further complicated by the fact that GNU chown treats -h as an option that affects all files, not just command-line files as POSIX would have it. And that GNU chown has a --dereference option that is intended to be the inverse of the -h option. I think the *intent* of the GNU code is that -h/--dereference controls only whether lchown or chown is used, and that -H/-L/-P control only whether symlinks to directories are followed in a recursive chown. But (a) that's not what the code really does, (b) the intent does not conform to POSIX, (c) the code does not conform to POSIX either, and (d) as mentioned above, POSIX is broken. It's a true mess. From unknown Sat Jun 21 03:22:57 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 19 Jan 2018 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator