X-Loop: help-debbugs@HIDDEN Subject: bug#31043: [PATCH] changed presentation in 'File permissions' in 'numeric, modes' Resent-From: kalle <kalle@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-coreutils@HIDDEN Resent-Date: Tue, 03 Apr 2018 13:53:01 +0000 Resent-Message-ID: <handler.31043.B.152276356810361 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 31043 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: 31043 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.152276356810361 (code B ref -1); Tue, 03 Apr 2018 13:53:01 +0000 Received: (at submit) by debbugs.gnu.org; 3 Apr 2018 13:52:48 +0000 Received: from localhost ([127.0.0.1]:36031 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1f3MMh-0002h3-Jh for submit <at> debbugs.gnu.org; Tue, 03 Apr 2018 09:52:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41568) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <kalle@HIDDEN>) id 1f3MMf-0002gp-T3 for submit <at> debbugs.gnu.org; Tue, 03 Apr 2018 09:52:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <kalle@HIDDEN>) id 1f3MMZ-0006Eg-BQ for submit <at> debbugs.gnu.org; Tue, 03 Apr 2018 09:52:40 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:42257) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <kalle@HIDDEN>) id 1f3MMZ-0006EE-7l for submit <at> debbugs.gnu.org; Tue, 03 Apr 2018 09:52:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <kalle@HIDDEN>) id 1f3MMX-0004Py-PB for bug-coreutils@HIDDEN; Tue, 03 Apr 2018 09:52:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <kalle@HIDDEN>) id 1f3MMT-00068Y-47 for bug-coreutils@HIDDEN; Tue, 03 Apr 2018 09:52:37 -0400 Received: from mail.netzguerilla.net ([2a00:1828:2000:612::25]:50477) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <kalle@HIDDEN>) id 1f3MMS-000658-QP for bug-coreutils@HIDDEN; Tue, 03 Apr 2018 09:52:33 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.netzguerilla.net (Postfix) with ESMTP id D0F7310001A for <bug-coreutils@HIDDEN>; Tue, 3 Apr 2018 15:52:29 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at netzguerilla.net Received: from mail.netzguerilla.net ([IPv6:2a00:1828:2000:612::25]) by localhost (sal.netzguerilla.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id ezjlXBuDgGqy for <bug-coreutils@HIDDEN>; Tue, 3 Apr 2018 15:52:28 +0200 (CEST) Received: from [IPv6:2003:dd:ff23:7e01:9110:c7e2:4def:c3df] (p200300DDFF237E019110C7E24DEFC3DF.dip0.t-ipconnect.de [IPv6:2003:dd:ff23:7e01:9110:c7e2:4def:c3df]) by mail.netzguerilla.net (Postfix) with ESMTPSA id 605BE100018 for <bug-coreutils@HIDDEN>; Tue, 3 Apr 2018 15:52:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=projektwerkstatt.de; s=fckp; t=1522763548; bh=RpJUpmU0SBIIKoKq0wT5UVtDNgdNT3Hs3FcgU+hxxaw=; h=From:Subject:To:Date:From; b=iwvdGIo6PuuYlJZanvxuLgGf9T+Z4by3IbVZS7ufyFg3zpd7T4boYpaGEaGdSdyFy mkMh2Q0QnLnduPfdbKJXu/XL74JNUdMpv5jn5pP7jtuvj4EsTNxxqzESzSaGFK4Bap O9npr6iJk83JwJr8NPvVKfeCPjzloCPonmYoj6xQQxweUQS+sKvUcMFdvNwQnoYoNN hcfYRwITUXUkZ5hVl4CQk4GqvUmlC3ydzwPR6AsCJnZCZhJhnzN3wSL2tbPqVbw3Ym 0GMfsMLlAS4B+DE8DvPiwMdS9NspmeRZsvM15OclAftmIitWzAgov/EmyseAKhyebi 2Pir0qJmEcuVQ== From: kalle <kalle@HIDDEN> Message-ID: <486ecfd6-e29f-71f1-936d-6e41e71c15ca@HIDDEN> Date: Tue, 3 Apr 2018 15:52:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 7bit 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: -5.0 (-----) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -5.0 (-----) hello, below a patch proposal of mine. kalle >From b250dcdaba02083a0174d9157c655f0dbb586ef6 Mon Sep 17 00:00:00 2001 From: kalle <kalle@HIDDEN> Date: Wed, 3 Jan 2018 20:56:07 +0100 Subject: [PATCH] changed presentation in 'File permissions' in 'numeric modes' I described the numeric modes explaining it's octal representation and how it is obtained from the symbolic notation. --- doc/perm.texi | 64 ++++++++++++++--------------------------------------------- 1 file changed, 15 insertions(+), 49 deletions(-) diff --git a/doc/perm.texi b/doc/perm.texi index c94c483..a514998 100644 --- a/doc/perm.texi +++ b/doc/perm.texi @@ -491,59 +491,25 @@ the file to all users. @cindex numeric modes @cindex file mode bits, numeric @cindex octal numbers for file modes -As an -alternative to giving a symbolic mode, you can give an octal (base 8) -number that represents the mode. -This number is always interpreted in octal; you do not have to add a -leading @samp{0}, as you do in C. Mode @samp{0055} is the same as -mode @samp{55}. (However, modes of five digits or more, such as -@samp{00055}, are sometimes special. @xref{Directory Setuid and Setgid}.) - -A numeric mode is usually shorter than the corresponding symbolic -mode, but it is limited in that normally it cannot take into account the -previous file mode bits; it can only set them absolutely. -The set-user-ID and set-group-ID bits of directories are an exception -to this general limitation. @xref{Directory Setuid and Setgid}. -Also, operator numeric modes can take previous file mode bits into -account. @xref{Operator Numeric Modes}. - -The permissions granted to the user, -to other users in the file's group, -and to other users not in the file's group each require three -bits, which are represented as one octal digit. The three special -mode bits also require one bit each, and they are as a group -represented as another octal digit. Here is how the bits are arranged, -starting with the lowest valued bit: +As an alternative to giving a symbolic mode, you can give an octal (with base 8) number that represents the mode.This number is always interpreted in octal; you do not have to add a leading @samp{0}, as you do in C. Mode @samp{0055} is the same as mode @samp{55}. Modes of five digits or more, such as @samp{00055}, have a special meaning for directories @xref{Directory Setuid and Setgid}.) + +A numeric mode is usually shorter than the corresponding symbolic mode, but it is limited in that normally it cannot take into account the previous file mode bits; it can only set them absolutely. The set-user-ID and set-group-ID bits of directories are an exception to this general limitation. @xref{Directory Setuid and Setgid}. Also, operator numeric modes can take previous file mode bits into account. @xref{Operator Numeric Modes}. + +The octal notation can be derived from the symbolic one, as an intermediate step transforming it into a binary string (1), which is then easily changed into octal base (2): + +(1)For the intermediate step the @samp{r},@samp{w} and @samp{x}-symbols of the symbolic notation are changed out at the corresponding place by a @samp{0} or a @samp{1}, according to whether the bits are clear or set (this works as long as there are no special mode bits, because every place belongs specifically to one kind of bit), thus transforming e.g. the string @samp{rwxr-xr--} into @samp{111101100}.Then instead of overriding the @samp{x}-bits, the special mode bits are represented by grouping them at the beginning, in the order suid|guid|sticky/restricted_deletion, thus e.g. describing symbolic @samp{rwsr-xr-t} as @samp{101111101101}. + +(2)Every 3 digits can then be grouped together and described as an octal digit, following the logic that three binary digits @samp{abc} are translated into an octal number a*2^2+b*2^1+c*2^0=a*4+b*2+c*1, e.g.: @example -Value in Corresponding -Mode Mode Bit - - Other users not in the file's group: - 1 Execute/search - 2 Write - 4 Read - - Other users in the file's group: - 10 Execute/search - 20 Write - 40 Read - - The file's owner: - 100 Execute/search - 200 Write - 400 Read - - Special mode bits: -1000 Restricted deletion flag or sticky bit -2000 Set group ID on execution -4000 Set user ID on execution +binary octal +101 5 +111 7 +011 3 @end example -For example, numeric mode @samp{4755} corresponds to symbolic mode -@samp{u=rwxs,go=rx}, and numeric mode @samp{664} corresponds to symbolic mode -@samp{ug=rw,o=r}. Numeric mode @samp{0} corresponds to symbolic mode -@samp{a=}. +thus transforming the binary @samp{101111101101} from the last example into octal @samp{5755}. + @node Operator Numeric Modes @section Operator Numeric Modes -- 1.9.1
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: kalle <kalle@HIDDEN> Subject: bug#31043: Acknowledgement ([PATCH] changed presentation in 'File permissions' in 'numeric, modes') Message-ID: <handler.31043.B.152276356810361.ack <at> debbugs.gnu.org> References: <486ecfd6-e29f-71f1-936d-6e41e71c15ca@HIDDEN> X-Gnu-PR-Message: ack 31043 X-Gnu-PR-Package: coreutils X-Gnu-PR-Keywords: patch Reply-To: 31043 <at> debbugs.gnu.org Date: Tue, 03 Apr 2018 13:53:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-coreutils@HIDDEN If you wish to submit further information on this problem, please send it to 31043 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 31043: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D31043 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
Received: (at control) by debbugs.gnu.org; 3 Apr 2018 15:35:26 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 03 11:35:26 2018 Received: from localhost ([127.0.0.1]:37264 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1f3Ny2-0007Oa-1S for submit <at> debbugs.gnu.org; Tue, 03 Apr 2018 11:35:26 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:51082) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1f3Ny0-0007ON-NK for control <at> debbugs.gnu.org; Tue, 03 Apr 2018 11:35:24 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id AC27516161A for <control <at> debbugs.gnu.org>; Tue, 3 Apr 2018 08:35:18 -0700 (PDT) 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 x-MR5QIypSnK for <control <at> debbugs.gnu.org>; Tue, 3 Apr 2018 08:35:18 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 1561016161F for <control <at> debbugs.gnu.org>; Tue, 3 Apr 2018 08:35:18 -0700 (PDT) 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 1cnrAxB1AGSU for <control <at> debbugs.gnu.org>; Tue, 3 Apr 2018 08:35:18 -0700 (PDT) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id F27F816161A for <control <at> debbugs.gnu.org>; Tue, 3 Apr 2018 08:35:17 -0700 (PDT) To: GNU bug control <control <at> debbugs.gnu.org> From: Paul Eggert <eggert@HIDDEN> Subject: merge Organization: UCLA Computer Science Department Message-ID: <d72048e5-8be5-60db-97ba-976f85bd696d@HIDDEN> Date: Tue, 3 Apr 2018 08:35:17 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 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: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.3 (--) merge 29069 31043
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.