Skip to content

build: gate utilities by target support#12317

Open
xtqqczze wants to merge 1 commit into
uutils:mainfrom
xtqqczze:not-supported-target
Open

build: gate utilities by target support#12317
xtqqczze wants to merge 1 commit into
uutils:mainfrom
xtqqczze:not-supported-target

Conversation

@xtqqczze

@xtqqczze xtqqczze commented May 15, 2026

Copy link
Copy Markdown
Contributor

Fix some compile errors on non-Unix platforms, failing pre-commit check

Related: #11019

@github-actions

github-actions Bot commented May 15, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/tail-n0f (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/seq/seq-epipe is now passing!

@codspeed-hq

codspeed-hq Bot commented May 15, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 38 untouched benchmarks
⏩ 332 skipped benchmarks1


Comparing xtqqczze:not-supported-target (1fc7d1b) with main (80cc829)2

Open in CodSpeed

Footnotes

  1. 332 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.

  2. No successful run was found on main (47d7c76) during the generation of this report, so 80cc829 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@xtqqczze xtqqczze marked this pull request as ready for review May 15, 2026 20:09
@oech3

oech3 commented May 16, 2026

Copy link
Copy Markdown
Contributor

I don't like this solution. This is already covered by feature.

@xtqqczze

Copy link
Copy Markdown
Contributor Author

I would like to get cargo clippy --workspace --all-targets --all-features working.

@oech3

oech3 commented May 16, 2026

Copy link
Copy Markdown
Contributor

It does not making a sense to clippy unsupported part.

@oech3

oech3 commented May 16, 2026

Copy link
Copy Markdown
Contributor

At least, I think distributor does not want to distribute stubs if Mafefile included a bug someday. compile_error! is better behavior for distributors.

@xtqqczze

This comment was marked as outdated.

@oech3

oech3 commented May 16, 2026

Copy link
Copy Markdown
Contributor

You should ask upstream to auto-skip clippy when compile_error! appear.
Stub should not be distributed accidentaly anyway.

@oech3

oech3 commented May 16, 2026

Copy link
Copy Markdown
Contributor

rust-lang/cargo#1197

@xtqqczze

Copy link
Copy Markdown
Contributor Author

We already use supports stubs for chcon and runcon: #8795

@oech3

oech3 commented May 16, 2026 via email

Copy link
Copy Markdown
Contributor

@xtqqczze

Copy link
Copy Markdown
Contributor Author

I guess we could avoid stubs with:

#![cfg_attr(not(unix), no_main)]
#![cfg(unix)]
uucore::bin!(uu_nohup);

Then we get a linker error, but at least no compile errors.

@oech3

oech3 commented May 16, 2026

Copy link
Copy Markdown
Contributor

How about just removing compile_error!?

@xtqqczze

Copy link
Copy Markdown
Contributor Author

The crate fails compile for non-Unix, so it seems the only options are to use a stub, linker error, or compile error.

@oech3

oech3 commented May 16, 2026

Copy link
Copy Markdown
Contributor

I passed cargo check -p uu_true with #![no_main] only. So it looks best solution.

@oech3

oech3 commented May 16, 2026

Copy link
Copy Markdown
Contributor

I'll investigate what I can do for bin! macro itself.

@xtqqczze xtqqczze force-pushed the not-supported-target branch from 2d58805 to 731518f Compare May 16, 2026 04:37
@xtqqczze xtqqczze changed the title Add support stubs for non-Unix targets Fix compile errors for non-Unix targets May 16, 2026
Comment thread src/uu/nohup/src/main.rs Outdated
@oech3

oech3 commented May 16, 2026

Copy link
Copy Markdown
Contributor

not(clippy)

@xtqqczze

Copy link
Copy Markdown
Contributor Author

not(clippy)

Doesn't help for compile errors, e.g. with cargo check.

@oech3

oech3 commented May 16, 2026

Copy link
Copy Markdown
Contributor

Linker error should happen also for multicall-call binary.

@xtqqczze

Copy link
Copy Markdown
Contributor Author

Linker error should happen also for multicall-call binary.

How can I test this?

@oech3

oech3 commented May 16, 2026

Copy link
Copy Markdown
Contributor

cargo check --no-default-features --features nohup

@xtqqczze xtqqczze force-pushed the not-supported-target branch from 731518f to f203f6c Compare May 16, 2026 13:38
@xtqqczze xtqqczze changed the title Fix compile errors for non-Unix targets Fix compile errors for non-Linux targets May 16, 2026
@xtqqczze xtqqczze marked this pull request as draft May 22, 2026 22:07
@xtqqczze xtqqczze force-pushed the not-supported-target branch from f203f6c to 60984f1 Compare May 22, 2026 22:08
@xtqqczze xtqqczze changed the title Fix compile errors for non-Linux targets Fix compile errors for non-Unix targets May 23, 2026
@xtqqczze xtqqczze marked this pull request as ready for review May 23, 2026 01:31
@xtqqczze xtqqczze force-pushed the not-supported-target branch 2 times, most recently from 21bea5f to ce199c2 Compare May 23, 2026 03:32
@xtqqczze xtqqczze changed the title Fix compile errors for non-Unix targets build: gate utilities by target support May 23, 2026
@oech3

oech3 commented May 25, 2026

Copy link
Copy Markdown
Contributor

stdbuf is supported on Windows now (very limited).

@xtqqczze xtqqczze force-pushed the not-supported-target branch 3 times, most recently from 854f23b to f5abdba Compare May 29, 2026 19:47
@sylvestre sylvestre force-pushed the not-supported-target branch from f5abdba to 1fc7d1b Compare June 7, 2026 20:57
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