Skip to content

build: gate utilities by target support - #12317

Draft
xtqqczze wants to merge 18 commits into
uutils:mainfrom
xtqqczze:not-supported-target
Draft

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

Conversation

@xtqqczze

@xtqqczze xtqqczze commented May 15, 2026 •

Copy link
Copy Markdown
Collaborator

Fix compilation errors on some platforms that caused cargo check to fail.

Closes #14912.
Related: #11019

@github-actions

github-actions Bot commented May 15, 2026 •

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/misc/io-errors (fails in this run but passes in the 'main' branch)
Note: The gnu test tests/tail/tail-n0f is now being skipped but was previously passing.

@codspeed

codspeed Bot commented May 15, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 27 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 37 untouched benchmarks
⏩ 434 skipped benchmarks1


Comparing xtqqczze:not-supported-target (3fb2a7b) with main (175f6e1)2

Open in CodSpeed

Footnotes

  1. 434 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 (b8657e8) during the generation of this report, so 175f6e1 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
Collaborator 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
Collaborator 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
Collaborator 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
Collaborator 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
Collaborator 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
Collaborator 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 force-pushed the not-supported-target branch 2 times, most recently from 0908e7b to fb677d3 Compare August 30, 2026 01:48
@xtqqczze xtqqczze self-assigned this Sep 28, 2026
@xtqqczze

Copy link
Copy Markdown
Collaborator Author

Closing, work is tracked by #14912.

@xtqqczze xtqqczze closed this Sep 28, 2026
@xtqqczze

Copy link
Copy Markdown
Collaborator Author

Reopening for CI.

@xtqqczze xtqqczze reopened this Oct 15, 2026
@xtqqczze
xtqqczze force-pushed the not-supported-target branch 3 times, most recently from bf8cdd3 to 60e4ee2 Compare October 15, 2026 18:13
Use `libc::EPERM` instead of `nix::errno::Errno::EPERM` to avoid referencing the optional `nix` dependency when it is not enabled.
Gate `install` to Unix targets.

`install` now builds successfully on AIX and Hurd:

```sh
RUSTC_BOOTSTRAP=1 cargo clippy -q -Zbuild-std -p uu_install --all-features --all-targets --target powerpc64-ibm-aix --target x86_64-unknown-hurd-gnu
```
The feature now compiles successfully on Haiku, Hermit and Hurd targets:

```sh
RUSTC_BOOTSTRAP=1 cargo clippy -q -Zbuild-std=std,panic_abort \
  -p uucore --features fsext --all-targets \
  --target powerpc64-ibm-aix \
  --target x86_64-linux-android \
  --target i686-linux-android \
  --target x86_64-pc-cygwin \
  --target aarch64-apple-darwin \
  --target x86_64-unknown-freebsd \
  --target x86_64-unknown-fuchsia \
  --target x86_64-unknown-haiku \
  --target x86_64-unknown-hurd-gnu \
  --target aarch64-unknown-illumos \
  --target x86_64-unknown-linux-gnu \
  --target i686-unknown-netbsd \
  --target x86_64-unknown-openbsd \
  --target x86_64-unknown-redox \
  --target x86_64-pc-solaris \
  --target wasm32-wasip1 \
  --target x86_64-pc-windows-gnu
```
@xtqqczze
xtqqczze force-pushed the not-supported-target branch from 60e4ee2 to 3fb2a7b Compare October 16, 2026 03:15

This branch has not been deployed

No deployments
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.

build: gate packages by target support

3 participants