# std.zig.system.NativeTargetInfo: fix glibc version parsing · gitcafe/zig

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

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

Visibility: public

Requested revision: 6bf554f9a75b412f3d1f2306dff8c0036555f08c

Requested commit: 6bf554f9a75b412f3d1f2306dff8c0036555f08c

Commit: 6bf554f9a75b412f3d1f2306dff8c0036555f08c

Tree: dde036caf73e984c02000e668c7c1c60394d924a

Author: Eric Joldasov

Committer: Andrew Kelley

## Message

```
std.zig.system.NativeTargetInfo: fix glibc version parsing

In most cases "GLIBC_2.X" strings and `/lib/libc-2.x.so` files do not contain third (`patch`) field,
which causes std.SemanticVersion.parse function to return error. To fix this, we
reuse [now-public] std.zig.CrossTarget.parseVersion function,
which accounts for this third field and makes it 0 in case it was not found.
This new behaviour is similar to std.builtin.Version.parse, which was removed in
https://github.com/ziglang/zig/commit/6e84f469904a24615a6721265a88ad8dcb4ed83a

Fixes regression from https://github.com/ziglang/zig/commit/6e84f469904a24615a6721265a88ad8dcb4ed83a
and https://github.com/ziglang/zig/pull/13998 .

Related: https://github.com/ziglang/zig/issues/17626 . Results with `zig end`:

Before: `"target": "x86_64-linux.6.5.7...6.5.7-gnu.2.19",`
After: `"target": "x86_64-linux.6.5.7...6.5.7-gnu.2.36",`

Also, while we are here, write explicit error sets and remove duplicate
logic from std.zig.system.darwin.macos.parseSystemVersion .

Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>

```

## Parents

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

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