Skip to content

Fix cp, chown, stat integration test failures#30

Open
kelp wants to merge 1 commit intomainfrom
fix-cp-chown-stat-integration-tests
Open

Fix cp, chown, stat integration test failures#30
kelp wants to merge 1 commit intomainfrom
fix-cp-chown-stat-integration-tests

Conversation

@kelp
Copy link
Copy Markdown
Owner

@kelp kelp commented Mar 31, 2026

Summary

  • stat: Fix timestamp leading + sign (Zig 0.15 formats signed ints with + when zero-padded; cast year to u32). Add Linux-specific StatFs struct layout (the macOS struct layout was producing garbage block sizes on Linux). Add /proc/self/mountinfo parsing for mount point and device on Linux.
  • chown: Implement GNU user: login group resolution per spec: "if a colon follows the user name but no group name is given, the user's login group is used."
  • cp: Fix -N flag -- it suppresses BSD file flags with -p, not symlink dereferencing. Fix -f read-only directory test setup to also make destination file read-only (matches GNU cp behavior where writable files in read-only dirs can be overwritten).

Test plan

  • just it-util stat -- 30/30 passed
  • just it-util chown -- 87/87 passed
  • just it-util cp -- 137/137 passed
  • zig build test --summary all -- all unit tests pass

stat: Fix timestamp leading '+' by casting year to u32. Add
Linux-specific StatFs struct layout (macOS layout produced
garbage on Linux). Add /proc/self/mountinfo parsing for mount
point and device name on Linux.

chown: Implement GNU "user:" login group resolution. When a
colon follows the user name with no group, set group to the
user's primary GID from passwd.

cp: Remove -N from symlink follow_none logic. BSD -N suppresses
file flags with -p; it should not affect symlink dereferencing.
Fix cp -f read-only directory test setup to also make the
destination file read-only (matches GNU behavior).
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