MModeLattice
Product

Product features · POSIX permission display

01

Check setuid, setgid and sticky bits with and without execute permission, rejecting negative or oversized modes without changing any file.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

POSIX permission display

● ● ●ModeLattice●
A concrete starting point · POSIX permission display ×
def permission_text(mode):
    if type(mode) is not int or not 0 <= mode <= 0o7777:
        raise ValueError("permission bits only")
    out = []
    for shift in (6, 3, 0):
        bits = (mode >> shift) & 7
        out.extend(c if bits & bit else "-"
                   for c, bit in zip("rwx", (4, 2, 1)))
    for pos, bit, mark in ((2, 0o4000, "s"), (5, 0o2000, "s"), (8, 0o1000, "t")):
        if mode & bit: out[pos] = mark if out[pos] == "x" else mark.upper()
    return "".join(out)
✳Format POSIX permission bits as nine readable characters.
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗