Skip to content

Fix acct type signature difference for AIX - #2661

Closed
dalvescb wants to merge 0 commit into
nix-rust:masterfrom
dalvescb:master
Closed

dalvescb wants to merge 0 commit into
nix-rust:masterfrom
dalvescb:master

Conversation

@dalvescb

Copy link
Copy Markdown

What does this PR do

Fixes acct mod to provide custom methods that account for differences in AIX's libc::acctl type interface

Checklist:

  • I have read CONTRIBUTING.md
  • Does not require a change in tests or rustdoc comments
  • Does not require to change to nix' API

@asomers asomers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why does AIX need a mutable pointer? If there is any possibility that it may modify the caller-provided string, then your pointer cast is invalid.

@dalvescb

Copy link
Copy Markdown
Author

Why does AIX need a mutable pointer?

This is just how AIX defines acct in its system headers (see https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/docs/apidiffs.html#read). On linux the function interface is int acct(const char *filename); and on AIX int acct (char *Path); The libc crate requires rust accurately reflects the system headers, hence when we ported it we needed to maintain a mutable pointer

If there is any possibility that it may modify the caller-provided string, then your pointer cast is invalid.

Despite the difference in interface, the Linux and AIX definitions of acct are documented as compatible and acct does not modify its argument. So the cast should be valid

@asomers asomers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is an unfortunate bug in AIX. We can work around it, as you suggest. But could you please add a comment describing why that pointer case is safe? And a changelog entry too?

@dalvescb

dalvescb commented Mar 5, 2026 •

Copy link
Copy Markdown
Author

We are pursuing getting the interface on AIX fixed, which should resolve this. So discarding this PR for now

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.

2 participants