# Truncate user and group ids for 64 bit Linux systems \(\#7466\) · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/7e63f7ad0311c80bcec89649d723af8a97935ba2)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 7e63f7ad0311c80bcec89649d723af8a97935ba2

Requested commit: 7e63f7ad0311c80bcec89649d723af8a97935ba2

Commit: 7e63f7ad0311c80bcec89649d723af8a97935ba2

Tree: c5186540d15202aa105e1853bf14ef52d37f8eb0

Author: Andreas Linz

Committer: GitHub

## Message

```
Truncate user and group ids for 64 bit Linux systems (#7466)

* Truncate user and group ids

Calls to `getuid`, `getgid` and their `eid` variants fail to compile on
64bit Linux systems because the return value of the syscall is of
`usize` and needs to be truncated to fit the size of `uid_t` that is 32
bit.

Thanks to @FireFox317 for figuring this out in Zig's Discord channel!

* Add a regression test for user and group ids

* Replace @truncate with @intCast

This should be safe because `uid_t` will be 32-bit.

* Add missing import for getauxval

* Add missing package names

* Revert "Add missing import for getauxval"

This reverts commit 38f93dc89effdf657f2b81a56b96527ce4083f52.

* Skip user and group test if builtin.link_libc
```

## Parents

- [4420dabdf5cb1ad421d62d946738eb61fcff0ce5](https://git.cafe/gitcafe/zig/commit/4420dabdf5cb1ad421d62d946738eb61fcff0ce5?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/7e63f7ad0311c80bcec89649d723af8a97935ba2?format=markdown)
