Skip to content

refactor: add cfg aliases - #11016

Draft
xtqqczze wants to merge 10 commits into
uutils:mainfrom
xtqqczze:cfg_aliases/selinux
Draft

refactor: add cfg aliases#11016
xtqqczze wants to merge 10 commits into
uutils:mainfrom
xtqqczze:cfg_aliases/selinux

Conversation

@xtqqczze

@xtqqczze xtqqczze commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

Fixes pre-commit hook failures on non-Linux platforms by adding proper #[cfg(target_os = "linux")] guards to selinux/smack feature gates.

Contributes to #11019

Closes #10995

@xtqqczze xtqqczze mentioned this pull request Feb 18, 2026
@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/date/resolution. tests/date/resolution is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/rm/isatty. tests/rm/isatty is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/tail/retry. tests/tail/retry is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)
Note: The gnu test tests/cp/link-heap is now being skipped but was previously passing.
Note: The gnu test tests/printf/printf-surprise is now being skipped but was previously passing.

@xtqqczze
xtqqczze force-pushed the cfg_aliases/selinux branch from b98f746 to bf4239f Compare February 18, 2026 19:02
@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Congrats! The gnu test tests/date/date-locale-hour is no longer failing!
Note: The gnu test tests/cp/link-heap is now being skipped but was previously passing.
Note: The gnu test tests/dd/no-allocate is now being skipped but was previously passing.
Note: The gnu test tests/seq/seq-epipe is now being skipped but was previously passing.
Note: The gnu test tests/tail/pipe-f is now being skipped but was previously passing.

@xtqqczze
xtqqczze force-pushed the cfg_aliases/selinux branch from bf4239f to 0fcde2d Compare February 18, 2026 19:13
@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Note: The gnu test tests/cut/cut-huge-range is now being skipped but was previously passing.

@xtqqczze
xtqqczze marked this pull request as ready for review February 18, 2026 19:54

@sylvestre sylvestre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sorry
i really don't like the duplication of src/uu/*/build.rs

@xtqqczze

Copy link
Copy Markdown
Contributor Author

I don’t like the duplication either, but I’m not sure how to avoid it. Do you have suggestions on how we could factor this out?

@sylvestre

Copy link
Copy Markdown
Contributor

i prefer the current state than this duplication, sorry

@xtqqczze

xtqqczze commented Feb 19, 2026

Copy link
Copy Markdown
Contributor Author

I guess we could include!("../../common/common_cfg.rs") in each build.rs?

@sylvestre

Copy link
Copy Markdown
Contributor

if it works, it would be better

@xtqqczze

Copy link
Copy Markdown
Contributor Author

I've tried specifying the cfg in .cargo/config.toml but it doesn't support expressions like all(...) or any(...).

The only alternative I can think of is introducing a small common_cfg helper crate to centralize the cfg_aliases logic, but that feels a bit heavy-handed.

@xtqqczze

xtqqczze commented Feb 19, 2026

Copy link
Copy Markdown
Contributor Author

I guess we could include!("../../common/common_cfg.rs") in each build.rs?

@sylvestre If this works, would you approve the changes?

@oech3

oech3 commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Cannot we use workespace's toplevel build.rs?

@sylvestre

Copy link
Copy Markdown
Contributor

Cannot we use workespace's toplevel build.rs?

i don't think it works. i tried too and failed

@sylvestre

Copy link
Copy Markdown
Contributor

I guess we could include!("../../../common/common_cfg.rs") in each build.rs?

@sylvestre If this works, would you approve the changes?

yes
thanks

@xtqqczze

xtqqczze commented Apr 3, 2026

Copy link
Copy Markdown
Contributor Author

I guess we could include!("../../common/common_cfg.rs") in each build.rs?

Annoyingly, this didn't work.

@github-actions

github-actions Bot commented Apr 3, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/cp/cp-a-selinux. tests/cp/cp-a-selinux is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/inotify-dir-recreate (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/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/cp/link-heap is now being skipped but was previously passing.
Note: The gnu test tests/env/env-signal-handler was skipped on 'main' but is now failing.

@sylvestre
sylvestre force-pushed the cfg_aliases/selinux branch from 945a586 to 5d3b4fd Compare April 4, 2026 11:03
@github-actions

github-actions Bot commented Apr 4, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/cp/cp-a-selinux. tests/cp/cp-a-selinux is passing on 'main'. Maybe you have to rebase?
Note: The gnu test tests/cut/cut-huge-range is now being skipped but was previously passing.

@xtqqczze
xtqqczze force-pushed the cfg_aliases/selinux branch from 5d3b4fd to 971a907 Compare April 4, 2026 18:06
@github-actions

github-actions Bot commented Apr 4, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/cp/cp-a-selinux. tests/cp/cp-a-selinux is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/tail/pipe-f is now passing!

@oech3

oech3 commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

I don't like symlink since it breaks tarball extraction on Windows, but can you symlink build.rs?

@xtqqczze

Copy link
Copy Markdown
Contributor Author

I don't like symlink since it breaks tarball extraction on Windows, but can you symlink build.rs?

Can't do this because some utilities already have a build.rs.

@xtqqczze

This comment was marked as outdated.

@xtqqczze
xtqqczze force-pushed the cfg_aliases/selinux branch from 0ce8ee5 to 496d9fd Compare April 23, 2026 12:57
@xtqqczze

This comment was marked as outdated.

@xtqqczze
xtqqczze force-pushed the cfg_aliases/selinux branch 3 times, most recently from 0d17e4e to 9b7dca7 Compare April 27, 2026 20:14
@oech3

oech3 commented May 7, 2026

Copy link
Copy Markdown
Contributor

I'm not sure if you still want to continue this. But if this is blocked by crate's limitation, you should open an issue at there.

@xtqqczze
xtqqczze force-pushed the cfg_aliases/selinux branch 2 times, most recently from 98c8cea to 905939c Compare May 7, 2026 12:54
@xtqqczze

xtqqczze commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

@oech3 It's not blocked, but I don't know how to avoid duplication of the aliases

@xtqqczze

xtqqczze commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

I guess we could include!("../../common/common_cfg.rs") in each build.rs?

This actually works, but rust-analyzer has an issue and shows a macro error: rust-lang/rust-analyzer#20129

@xtqqczze
xtqqczze force-pushed the cfg_aliases/selinux branch from 905939c to b5bdfc2 Compare May 7, 2026 13:24
@xtqqczze xtqqczze changed the title add selinux/smack cfg alias refactor: add cfg aliases May 7, 2026
@xtqqczze
xtqqczze force-pushed the cfg_aliases/selinux branch 2 times, most recently from 5a8245d to cf5b309 Compare May 7, 2026 13:41
@codspeed-hq

codspeed-hq Bot commented May 7, 2026

Copy link
Copy Markdown

Merging this PR will regress 4 benchmarks

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
❌ 4 regressed benchmarks
✅ 339 untouched benchmarks
⏩ 46 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation numfmt_to_si_precision[10000] 90.5 ms 95 ms -4.79%
Simulation du_max_depth_balanced_tree[(6, 4, 10)] 60.2 ms 62.3 ms -3.32%
Simulation numfmt_large_numbers_si[10000] 92.8 ms 95.9 ms -3.24%
Simulation du_summarize_balanced_tree[(5, 4, 10)] 15.5 ms 16 ms -3.17%
Simulation false_consecutive_calls 383.6 ns 316.9 ns +21.04%
Simulation ls_recursive_deep_tree[(200, 2)] 3.6 ms 3.5 ms +4.39%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing xtqqczze:cfg_aliases/selinux (ff464bc) with main (b13ee7a)

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 force-pushed the cfg_aliases/selinux branch 3 times, most recently from b857ab8 to f2a0541 Compare August 2, 2026 12:16
@xtqqczze
xtqqczze force-pushed the cfg_aliases/selinux branch from f2a0541 to ff464bc Compare August 2, 2026 23:40
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.

3 participants