Skip to content

Fix compile errors for non-Linux targets#12317

Open
xtqqczze wants to merge 3 commits into
uutils:mainfrom
xtqqczze:not-supported-target
Open

Fix compile errors for non-Linux targets#12317
xtqqczze wants to merge 3 commits into
uutils:mainfrom
xtqqczze:not-supported-target

Conversation

@xtqqczze
Copy link
Copy Markdown
Contributor

@xtqqczze xtqqczze commented May 15, 2026

Contributes to #11019

to avoid compile errors on non-Linux platforms, failing pre-commit check

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/misc/io-errors (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/retry (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/cut/cut-huge-range is now being skipped but was previously passing.
Skip an intermittent issue tests/pr/bounded-memory (was skipped on 'main', now failing)

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 15, 2026

Merging this PR will improve performance by 13.71%

⚡ 2 improved benchmarks
✅ 315 untouched benchmarks
⏩ 46 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory cp_recursive_deep_tree[(120, 4)] 699.2 KB 562.5 KB +24.31%
Simulation ls_recursive_balanced_tree[(6, 4, 15)] 50.9 ms 48.9 ms +4.01%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing xtqqczze:not-supported-target (f203f6c) with main (d09f351)

Open in CodSpeed

Footnotes

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

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

oech3 commented May 16, 2026

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
Copy link
Copy Markdown
Contributor

oech3 commented May 16, 2026

It does not making a sense to clippy unsupported part.

@oech3
Copy link
Copy Markdown
Contributor

oech3 commented May 16, 2026

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
Copy link
Copy Markdown
Contributor

oech3 commented May 16, 2026

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

@oech3
Copy link
Copy Markdown
Contributor

oech3 commented May 16, 2026

rust-lang/cargo#1197

@xtqqczze
Copy link
Copy Markdown
Contributor Author

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

@oech3
Copy link
Copy Markdown
Contributor

oech3 commented May 16, 2026 via email

@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
Copy link
Copy Markdown
Contributor

oech3 commented May 16, 2026

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
Copy link
Copy Markdown
Contributor

oech3 commented May 16, 2026

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

@oech3
Copy link
Copy Markdown
Contributor

oech3 commented May 16, 2026

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
@oech3
Copy link
Copy Markdown
Contributor

oech3 commented May 16, 2026

not(clippy)

@xtqqczze
Copy link
Copy Markdown
Contributor Author

not(clippy)

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

@oech3
Copy link
Copy Markdown
Contributor

oech3 commented May 16, 2026

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
Copy link
Copy Markdown
Contributor

oech3 commented May 16, 2026

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
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