Package: coreutils;
Reported by: kalle <kalle <at> projektwerkstatt.de>
Date: Mon, 30 Oct 2017 18:35:01 UTC
Severity: normal
Tags: notabug, patch
Merged with 31043
Message #31 received at submit <at> debbugs.gnu.org (full text, mbox):
From: kalle <kalle <at> projektwerkstatt.de> To: bug-coreutils <at> gnu.org, assafgordon <at> gmail.com, 29069 <at> debbugs.gnu.org Subject: bug#29069 Date: Sun, 25 Mar 2018 16:43:55 +0000
hello people. I once wrote some improvement proposals to the list. assafgordon <at> gmail.com wrote to me " You wrote many good suggestions and text improvements. If you'd like to see them through, the best way is to offer a patch suitable for inclusion. For instructions on how to send such patch, please see https://git.savannah.gnu.org/cgit/coreutils.git/tree/HACKING https://git.savannah.gnu.org/cgit/coreutils.git/tree/README-hacking As your contribution is significant (more than 10 lines), it'll also require copyright assignment (see https://www.gnu.org/licenses/why-assign.html ). If you prefer not to spend time on making such a patch, that is of course completely fine. In that case, this will have to wait until one of the maintainers (or another volunteer) decides to spend the time required to incorporate these improvements. " Since then I extra learned git, to be able to give in the patches myself. But for my last 2 mails sending in my patch proposals, no response came... here now for the 4th time again my patch proposal for chapter 27.3: >From b250dcdaba02083a0174d9157c655f0dbb586ef6 Mon Sep 17 00:00:00 2001 From: kalle <kalle <at> projektwerkstatt.de> 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
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.