From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 21 22:00:11 2017 Received: (at submit) by debbugs.gnu.org; 22 Nov 2017 03:00:11 +0000 Received: from localhost ([127.0.0.1]:51693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eHLGl-0001x7-G5 for submit@debbugs.gnu.org; Tue, 21 Nov 2017 22:00:11 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41247) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eHL3p-0001cb-Jq for submit@debbugs.gnu.org; Tue, 21 Nov 2017 21:46:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHL3j-0000vJ-MI for submit@debbugs.gnu.org; Tue, 21 Nov 2017 21:46:44 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:60178) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eHL3j-0000v7-IT for submit@debbugs.gnu.org; Tue, 21 Nov 2017 21:46:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHL3i-0003PW-Iv for bug-coreutils@gnu.org; Tue, 21 Nov 2017 21:46:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHL3f-0000ps-Ci for bug-coreutils@gnu.org; Tue, 21 Nov 2017 21:46:42 -0500 Received: from mail-io0-x231.google.com ([2607:f8b0:4001:c06::231]:45404) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eHL3f-0000nk-6t for bug-coreutils@gnu.org; Tue, 21 Nov 2017 21:46:39 -0500 Received: by mail-io0-x231.google.com with SMTP id z74so21654608iof.12 for ; Tue, 21 Nov 2017 18:46:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=8R5qyzERa2i8gmK9CsRX3GhZt23A4Shbev8K3HdNr7s=; b=bfp5DRBJE0IbJAGKFfsHPWWZob13kfTs1VNHmFhr+/bRVt46Ka5EcdKpt56sfn/f3K dOW1oi71SYYfwnUbhMQmxb5K9GjmWYJSdgsnOhIKP8arCpeC/DehijQ7bfQqfoRllkpN UkFiB5A1tXW7kocB48ehd3S5FZNjb7812f7DnfQ667W3B7CkIYJoZs41JoPnMt/MocRK 9AgQreIADlHhfFb8s8Cy15RhEtDKlrYuUHFptA2ZHYLS+Zkb7y8laz6feznE99FO9ywv mt/5qp+Ms/wZwQAITXoCMxrrwTdEU+7rnRoYahWLwn0HQ9phW318EDd6BxDuz7vzz5EV 7piQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=8R5qyzERa2i8gmK9CsRX3GhZt23A4Shbev8K3HdNr7s=; b=WG3/2tLNuVwK+xQ81bazooxuPN4vfbQwlrIKGVc2R/pXqnvZIZ5t1jvyozGIS22qSN MV3NhdBQovXtrQuY201huLcnQmJk8oDfhkREujwlpTB6KchGJRtWj4SS6HXsgzSj/v6f VSDbGLVfnya7OZBZgZiApesrEJtfQ26JerXYDUTRHGGWEFD7yBV7kKkuDZ5CMnGNGhRS PXHNkSshchxsZY6C0sHk8RPDg9tNqHTpL/E+1BX3WgSGdf/Y49OycUea/hwRCM8qrCOH AiEs8o9Pi41xiCxNDZzwJfjy6VcAFplg7l1vv7viI6Bct4pRfIDBhgKYHn627uQ92BUj xaLA== X-Gm-Message-State: AJaThX7QI3iiAsAsEqMqhhRlv7j7orBeF6x+ZzSQ9BNpXu0O32FnSKru QqoG8uUTza9FxOQqC7mGTf2jF7xl X-Google-Smtp-Source: AGs4zMbgilBz8CPC7McC1Ry3mMQrMy0zSqaIBDn+Y7nLG9Enx28y7oUQMU9K0kbLvJtD798qa0t9XA== X-Received: by 10.107.137.170 with SMTP id t42mr6318385ioi.274.1511318796561; Tue, 21 Nov 2017 18:46:36 -0800 (PST) Received: from [192.168.1.130] (140-186-74-105-dynamic.midco.net. [140.186.74.105]) by smtp.gmail.com with ESMTPSA id r65sm4316797ith.3.2017.11.21.18.46.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Nov 2017 18:46:34 -0800 (PST) From: Oliver Isaac Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: chmod man page - clear setuid/setgid with numerical value Message-Id: Date: Tue, 21 Nov 2017 20:46:33 -0600 To: bug-coreutils@gnu.org X-Mailer: Apple Mail (2.3273) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 21 Nov 2017 22:00:09 -0500 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.0 (----) Hello, There is an incorrect assertion made in the chmod man page: Under the setuid/setgid header it says, "you can set (but not clear) the = bits with a numeric mode" This is not entirely true. If you prefix your numeric mode with a 0 then = it will work: e.g.: touch myfile chmod 644 myfile ls -l myfile chmod g+s myfile Is -l myfile chmod 00644 myfile is -l myfile This simple test shows that you can clear the uid/gid bits with numeric = mode which is especially useful in scripts. An update to the man page to clarify this would be helpful.=20 Thanks, Oliver= From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 09 21:33:02 2017 Received: (at 29390-done) by debbugs.gnu.org; 10 Dec 2017 02:33:02 +0000 Received: from localhost ([127.0.0.1]:54354 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eNrQL-0002nC-ND for submit@debbugs.gnu.org; Sat, 09 Dec 2017 21:33:02 -0500 Received: from mail.magicbluesmoke.com ([82.195.144.49]:59728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eNrQK-0002mz-57 for 29390-done@debbugs.gnu.org; Sat, 09 Dec 2017 21:33:00 -0500 Received: from localhost.localdomain (c-73-158-116-184.hsd1.ca.comcast.net [73.158.116.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 5AE779B98; Sun, 10 Dec 2017 02:32:56 +0000 (GMT) Subject: Re: bug#29390: chmod man page - clear setuid/setgid with numerical value To: Oliver Isaac , 29390-done@debbugs.gnu.org References: From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: Date: Sat, 9 Dec 2017 18:32:53 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------C01917B5BC97A6808B91CE0C" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 29390-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 (/) This is a multi-part message in MIME format. --------------C01917B5BC97A6808B91CE0C Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit On 21/11/17 18:46, Oliver Isaac wrote: > Hello, > > There is an incorrect assertion made in the chmod man page: > > Under the setuid/setgid header it says, "you can set (but not clear) the bits with a numeric mode" > > This is not entirely true. If you prefix your numeric mode with a 0 then it will work: > > e.g.: > > touch myfile > chmod 644 myfile > ls -l myfile > chmod g+s myfile > Is -l myfile > chmod 00644 myfile > is -l myfile > > > This simple test shows that you can clear the uid/gid bits with numeric mode which is especially useful in scripts. > > An update to the man page to clarify this would be helpful. Yes we should update the man page to be consistent. The current text was added in COREUTILS-6_9-89-gf4a5097 It was correct at the time, but slightly ambiguous as it might be missed that the paragraph pertains only to directories, and not files. Then http://debbugs.gnu.org/8391 (v8.15-64-g8931cdb) changed things to allow leading 00 to clear the setuid and setgid bits of _directories_ with numeric modes. BTW I notice solaris accepts 00755 as a mode but does _not_ clear these bits for directories. I.E. the most portable and simplest way to access this functionality is to use `chmod -s dir` Proposed patch attached. cheers, Pádraig --------------C01917B5BC97A6808B91CE0C Content-Type: text/x-patch; name="chmod-setgid-man.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="chmod-setgid-man.patch" >From 532b4285de02190aa9cf36140d83a8b871080458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Sat, 9 Dec 2017 18:26:56 -0800 Subject: [PATCH] doc: clarify numeric setuid handling in chmod man page * man/chmod.x: Update the information to state one can clear the setuid and setgid bits for directories numerically using an additional leading '0' or a leading '='. That has been supported since v8.15-64-g8931cdb. Fixes https://bugs.gnu.org/29390 --- man/chmod.x | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/man/chmod.x b/man/chmod.x index ff013a3..cf31ea7 100644 --- a/man/chmod.x +++ b/man/chmod.x @@ -87,14 +87,19 @@ functionality of the underlying system call. When in doubt, check the underlying system behavior. .PP +For directories .B chmod -preserves a directory's set-user-ID and set-group-ID bits unless you +preserves set-user-ID and set-group-ID bits unless you explicitly specify otherwise. You can set or clear the bits with symbolic modes like .B u+s and -.BR g\-s , -and you can set (but not clear) the bits with a numeric mode. +.BR g\-s . +To clear these bits for directories with a numeric mode requires +an additional leading zero, or leading = like +.B 00755 +, or +.B =755 .SH "RESTRICTED DELETION FLAG OR STICKY BIT" The restricted deletion flag or sticky bit is a single bit, whose interpretation depends on the file type. For directories, it prevents -- 2.9.3 --------------C01917B5BC97A6808B91CE0C-- From unknown Sat Sep 06 21:07:49 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 07 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