ISSUE #58 - Add POSIX setgid/setuid/sticky bit support
Fixes #58
Description
Here, I adjust the POSIX_LS_RE to account for s, S, t, and T in the "pex"-y positions, by adding them to the set of characters we scan for 9 of. Now, the following characters are included in the scan:
-rwxsStT, where previously only -rwxs were supported. Off-hand, it appears the s was an attempt to support setuid/setgid, but it did not cover the case where the x bit is not set, which renders as a S.
Because this regex did not previously validate for the correct ordering (i.e., refuting strange combos like rxw), I did not add them in this PR.
The pex parsing closure, which does some simple arithmetic to determine the "pex" value, needed some updates.
S and T indicate the presence of a setuid/setgid bit, or a sticky bit, but withoutx. (If x is set, then the S instead is typically reported as s.)
So, I added S and T as exceptions in addition to -. They will be treated the same. With this change, no information is recorded about the setuid/setgid bits, and I don't think the interpretation of them is of great importance at this time given they are interpreted locally by the operating system and they have different meanings.
Type of change
Please select relevant options.
[x] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] This change requires a documentation update
Checklist
[x] My code follows the contribution guidelines of this project
[x] I have performed a self-review of my own code
[x] I have commented my code, particularly in hard-to-understand areas
[x] My changes generate no new warnings
[x] I formatted the code with cargo fmt
[x] I linted my code using cargo clippy and reports no warnings
[x] I have added tests that prove my fix is effective or that my feature works
[x] I have introduced no C-bindings
[x] I increased or maintained the code coverage for the project, compared to the previous commit
Acceptance tests
wait for a project maintainer to fulfill this section...
ISSUE #58 - Add POSIX setgid/setuid/sticky bit support
Fixes #58
Description
Here, I adjust the
POSIX_LS_RE
to account fors
,S
,t
, andT
in the "pex"-y positions, by adding them to the set of characters we scan for 9 of. Now, the following characters are included in the scan:-rwxsStT
, where previously only-rwxs
were supported. Off-hand, it appears thes
was an attempt to support setuid/setgid, but it did not cover the case where thex
bit is not set, which renders as aS
.Because this regex did not previously validate for the correct ordering (i.e., refuting strange combos like
rxw
), I did not add them in this PR.The
pex
parsing closure, which does some simple arithmetic to determine the "pex" value, needed some updates.S
andT
indicate the presence of a setuid/setgid bit, or a sticky bit, but withoutx
. (Ifx
is set, then theS
instead is typically reported ass
.)So, I added
S
andT
as exceptions in addition to-
. They will be treated the same. With this change, no information is recorded about the setuid/setgid bits, and I don't think the interpretation of them is of great importance at this time given they are interpreted locally by the operating system and they have different meanings.Type of change
Please select relevant options.
Checklist
cargo fmt
cargo clippy
and reports no warningsAcceptance tests
wait for a project maintainer to fulfill this section...