Skip to content

grcat: add grcat command for gawk library routines - #62

Open
Franklin-Qi wants to merge 2 commits into
uutils:mainfrom
Franklin-Qi:fix-issue#60-add-grcat
Open

Franklin-Qi wants to merge 2 commits into
uutils:mainfrom
Franklin-Qi:fix-issue#60-add-grcat

Conversation

@Franklin-Qi

Copy link
Copy Markdown
Collaborator

Add a Rust implementation of grcat, the helper binary shipped by GNU awk under lib/awk/. It dumps the group database in /etc/group format via POSIX getgrent()/endgrent(), matching the program described in the GNU Awk User's Guide and used by gawk library routines such as group.awk.

  • Register the grcat binary in Cargo.toml with a unix-only libc dependency
  • Handle BrokenPipe on stdout writes without exiting with an error
  • Add integration tests for output format and parity with getent group

Closes #60

@Franklin-Qi Franklin-Qi changed the title packaging: add grcat command for gawk library routines grcat: add grcat command for gawk library routines Jul 3, 2026
@oech3

oech3 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Can we avoid unsafe libc using nix or rustix?

@Alonely0 Alonely0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my end, same comments as in the other PR.

Comment thread src/bin/grcat.rs Outdated
Comment thread src/bin/grcat.rs Outdated
Comment thread src/bin/grcat.rs Outdated
Comment thread tests/grcat.rs Outdated
Comment thread tests/grcat.rs Outdated
Comment thread tests/grcat.rs Outdated
Annotate elided lifetimes on prop-test helpers so clippy -D warnings
passes under the current toolchain.
Add the grcat helper used by gawk library routines such as group.awk.
Print /etc/group-format lines from getgrent/endgrent, return ExitCode
from main, and treat BrokenPipe as success. libc is needed because
rustix/nix do not expose the group-database iterators.

Closes uutils#60
@Franklin-Qi
Franklin-Qi force-pushed the fix-issue#60-add-grcat branch from e9e2863 to d6279c4 Compare September 30, 2026 10:05
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.

Add grcat command

4 participants