Skip to content

feat: new abilities#22

Merged
Charliechen114514 merged 4 commits into
mainfrom
feat/phase4-sweep
Jul 14, 2026
Merged

feat: new abilities#22
Charliechen114514 merged 4 commits into
mainfrom
feat/phase4-sweep

Conversation

@Charliechen114514

Copy link
Copy Markdown
Member

No description provided.

src/applets/dd.cpp: convert-and-copy with operands (key=value, not flags):
bs/ibs/obs (byte suffixes c/w/b/K/M/G/T), count, if/of, skip/seek, conv
(notrunc/noerror/sync/fsync/fdatasync), status (none/noxfer/progress).
Raw POSIX block I/O via io::unique_fd (RAII); reblocks ibs->obs when they
differ; conv=sync zero-pads short reads; transfer stats to stderr.

Registered (applets.hpp + applet_config.hpp.in + cmake/Config.cmake CFBOX_APPLETS).
+10 GTest (489 total) + integration test_dd.sh (55 scripts). size-opt 479->483 KB.
POSIX coverage utility 61->62/77 (baseline updated).
…/umask/ulimit/wait/times/unalias)

src/applets/sh/sh_builtins.cpp: add find_in_path helper + 10 builtins.
type/command resolve builtins->functions->$PATH; command -v/-V describe,
command <cmd> executes without consulting functions (fork+execvp). exec
replaces the process (execvp). getopts drives OPTIND/OPTARG/OPTERR vars
over positional or explicit args. umask reads/sets (octal + -S symbolic).
ulimit -a/-f/-n/-s/-c/-d/-v get/set via getrlimit/setrlimit. wait waitpids
(any or pid). times prints RUSAGE self+children. hash/unalias are no-ops
(cfbox has no command cache or alias table — POSIX-permitted).

POSIX coverage builtin 10/20 -> 20/20 (100%); total 74% -> 84% (baseline
updated). +test_sh_builtins.sh integration (11 checks). ctest 489 still green.

Known follow-up: wait cannot join background jobs yet — cfbox sh has no
& job table; wait is registered and type-visible but functional job-wait
needs sh_executor work (separate batch).
tests/differential/: framework.sh (run_diff/run_diff_in compare cfbox vs a
busybox oracle, classify MATCH/FAIL), test_diff_coreutils.sh (33 core
text-applet cases), run_all.sh. Needs a built busybox oracle
(competition/busybox/busybox; defconfig with CONFIG_TC off — tc needs kernel
headers absent in the build env).

First run immediately surfaced 2 real divergences, both fixed:
- wc: print_counts padded every count to width 8 (GNU style). BusyBox only
  pads when there are multiple files. Added a 'pad' arg: stdin/single-file
  print plain, multi-file/total keep %8ld alignment.
- cut -c: char mode erroneously joined selected chars with the field delim
  (tab), printing 'a\tb\tc' for 'cut -c1-3'. Char mode now emits selected
  chars contiguously ('abc'). Field mode unchanged.

test_diff_coreutils: 33 match, 0 fail. ctest 489 + integration still green.
Not wired into CI (needs the busybox oracle build step).
ibs/obs were uint64_t, but they feed std::vector ctors, read()/memset()
sizes and got==ibs comparisons — all size_t. On 32-bit armhf (size_t =
unsigned int) the uint64_t->size_t narrowing tripped -Werror=conversion
in CI. ibs/obs are now size_t (a block size never realistically exceeds
SIZE_MAX); count/skip/seek stay uint64_t (may be large, used for loops
and lseek off_t). Parse assignments cast n->size_t.

Verified locally: armhf cross-compile green, native ctest 489 + dd 10 green.
This was the only CI failure on feat/phase4-sweep (native/release-size passed).
@Charliechen114514
Charliechen114514 merged commit 246b80e into main Jul 14, 2026
8 checks passed
@Charliechen114514
Charliechen114514 deleted the feat/phase4-sweep branch July 14, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant