37 lines
1.9 KiB
Markdown
37 lines
1.9 KiB
Markdown
# Filesystem and identity commands
|
|
|
|
These commands supplement the default coreutils build.
|
|
|
|
- `id` reports `uid=0(root) gid=0(root) groups=0(root)`. The world has one user.
|
|
`-u` and `-g` print zero. `-n` prints `root`, including `-un` and `-gn`.
|
|
- `du` sums apparent file sizes. Directories contribute zero bytes.
|
|
It supports `-s`, `-h`, `-a`, `-c`, `-d`/`--max-depth`, `-b`, and `-k`.
|
|
The default unit and `-k` use 1024 bytes. `-b` uses bytes.
|
|
Symlinks contribute their own size. The command does not follow them.
|
|
Native comparisons use `du --apparent-size` on files.
|
|
Native directory totals include host directory storage, which the world does not expose.
|
|
- `stat` supports `-c`/`--format`, `-L`, and multiple paths.
|
|
Formats: `%n %s %F %Y %y %X %x %N %% %a %A %U %G %u %g`.
|
|
Times use UTC. UID and GID are zero. User and group names are `root`.
|
|
Modes are fixed at `755` for directories and `644` otherwise.
|
|
The default output prints names, sizes, types, modes, identity, and timestamps.
|
|
- `nohup COMMAND [ARG...]` uses the existing process interface.
|
|
It starts an independent process group and returns the command's exit status.
|
|
The world has no terminal or SIGHUP. Non-terminal streams remain inherited.
|
|
It does not detach the command or create `nohup.out`, like native nohup with redirected streams.
|
|
|
|
## Tests
|
|
|
|
From `userland/`, use the executor's `CARGO_TARGET_DIR`:
|
|
|
|
```sh
|
|
nix develop -c cargo build -p sausage-fs-tools --release --locked
|
|
nix develop -c nu --no-config-file fs-tools/test.nu
|
|
nix develop -c nu --no-config-file fs-tools/world-test.nu /tmp/s6-esbuild/app /tmp/s6-esbuild/esbuild-native
|
|
```
|
|
|
|
The world test requires the host binary and brush in the same target folder.
|
|
It also requires the pinned preview1 tools and the built archive tools.
|
|
The fixture contains S6's app, `check.mjs`, and its installed dependencies.
|
|
The test creates a fresh world under `/tmp`. It does not use the live world.
|