Skip to content

Add failing tests for env and free IMPORTANT audit findings#13

Open
kelp wants to merge 1 commit intomainfrom
audit-wave4-env-free
Open

Add failing tests for env and free IMPORTANT audit findings#13
kelp wants to merge 1 commit intomainfrom
audit-wave4-env-free

Conversation

@kelp
Copy link
Copy Markdown
Owner

@kelp kelp commented Mar 30, 2026

Summary

  • Add 3 failing unit tests for env IMPORTANT audit findings
  • Add 3 failing unit tests for free IMPORTANT audit findings
  • Add integration tests for all 6 findings

env findings tested

  1. -0 with utility not rejected: spec says both cannot be
    given together. Currently passes through to exec instead of
    erroring with exit 125.
  2. Flags after NAME=VALUE still parsed: after a NAME=VALUE
    token, subsequent flag-like tokens should start the command.
    Currently -u after FOO=bar is still parsed as a flag.
  3. -P sets PATH in child env: spec says -P restricts the
    search path for the utility, not the child's PATH variable.
    Currently env -i -P /path FOO=bar shows PATH in output.

free findings tested

  1. -w wide mode buffers column always 0: MemInfo merges
    buffers+cached into buff_cache, losing the individual buffers
    value. Wide mode hardcodes 0 for the buffers column.
  2. -c without -s silently succeeds: GNU free errors with
    "free: -c requires -s option". We silently display once.
  3. -s short flag hijacked by si: argparse maps si field
    name[0]='s' as its short flag, so -s sets si=true instead
    of --seconds. Makes -s 1 -c 1 fail with "extra operand".

Test plan

  • All 6 unit tests fail for the correct reasons
  • No test hangs (verified with zig build test --summary all)
  • No implementation code modified
  • Phase 2: fix implementations to make tests pass

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