procfetch
procfetch copied to clipboard
Get user name by getpwuid instead of environment variable USER
Description
getlogin(2) does not return the expected value.
Instead, getpwuid(3) can be used to retrieve the user name.
To test this, I've prepared a repository youpong/getuser.
See function test_getlogin() for getlogin(2) behavior, function getuser() for an example implementation in getpwuid(3).
You can see the results of the multi-platform behavior in the GitHub Actions log.
Related Issue
- #148
Unit tests are failing.
The reason is that ubuntu:latest in Github Actions is still using 22.04 LTS, so the std::format adopted in standard C++20 is not available.
clang++ (not g++) on Ubuntu 22.04 LTS can use std::format. I would like to propose to use clang++ for unit test.
Coverage testing has failed. This is because it uses g++.
Maybe Ubuntu 24.04 LTS will be available in a few months, so it's a not bad idea not to take action. What do you think?
I believe we would want procfetch to be compatible with older distributions too, including the tests!
I think that being available in various distributions, old and new, is not about being able to build, but about having binaries available. And while unit testing should be checked with every commit, coverage testing should be enough to get a trend every few months.
1 hour ago: https://github.blog/changelog/2024-05-14-github-hosted-runners-public-beta-of-ubuntu-24-04-is-now-available/
Thank you for information. I'm traveling for a couple of days. I'll take a look later.
We'll also need to update the unit test images to 24.04.
~~Added ubuntu-24.04 as a runner host for unit testing.
ubuntu-latest is left as it is.
It is OK if the test succeeds on ubuntu-24.04, even if it fails on ubuntu-latest.~~
Update ubuntu-latset to ubuntu-24.04 on unit testing.
The OS version of ubuntu-latest is 22.04 now, but will be 24.04 in a few months. We will ~~remove~~ update ubuntu-24.04 to ubuntu-latest on unit testing and coverage testing at that time.