Skip to content

fix(logname): return error exit code when there is an error#9313

Open
rodrigost23 wants to merge 3 commits intouutils:mainfrom
rodrigost23:fix-logname-exit-code
Open

fix(logname): return error exit code when there is an error#9313
rodrigost23 wants to merge 3 commits intouutils:mainfrom
rodrigost23:fix-logname-exit-code

Conversation

@rodrigost23
Copy link

Fixes #9312

@sylvestre
Copy link
Contributor

could you please add a test to make sure we don't regress in the future? thanks

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 17, 2025

CodSpeed Performance Report

Merging #9313 will not alter performance

Comparing rodrigost23:fix-logname-exit-code (8da2ce3) with main (2d718f2)

Summary

✅ 127 untouched
⏩ 6 skipped1

Footnotes

  1. 6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

use uutests::util_name;
let ts = TestScenario::new(util_name!());

ts.cmd("unshare")
Copy link
Contributor

Choose a reason for hiding this comment

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

why unshare here ?

Copy link
Author

Choose a reason for hiding this comment

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

I've tried making getlogin return null by

  1. setting stdin to /dev/null
  2. using terminal_sim_stdio with stdin set to false
  3. using setsid logname

On my machine, none of these caused it to return null. Running it with unshare -U logname did produce the expected error.

Do you know a more reliable way to trigger this behavior without using unshare?

Copy link
Contributor

@oech3 oech3 Jan 1, 2026

Choose a reason for hiding this comment

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

@rodrigost23 User NS sandbox is disabled at Ubuntu by default. Would you add to CI file something like https://github.com/oech3/coreutils/blob/9cf774bed8919636f437caf0e7ee379fc701cdab/.github/workflows/GnuTests.yml#L121-L123 (with spell-checker:ignore userns)?

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

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.

logname: uutils version returns zero even when there is error "no login name"

3 participants