GNU bug report logs - #31043
[PATCH] changed presentation in 'File permissions' in 'numeric, modes'

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Reported by: kalle <kalle@HIDDEN>; Keywords: patch notabug; merged with #29069; dated Tue, 3 Apr 2018 13:53:01 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.
Merged 29069 31043. Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Apr 2018 13:52:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 03 09:52:48 2018
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>
Subject: [PATCH] changed presentation in 'File permissions' in 'numeric, modes'
To: bug-coreutils@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-Debbugs-Envelope-To: submit
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






Acknowledgement sent to kalle <kalle@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#31043; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 3 Apr 2018 15:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.