Skip to content

Commit c315de5

Browse files
authored
Merge branch 'main' into sort_ignore_broken_pipe
2 parents ed711d6 + 799de29 commit c315de5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+988
-428
lines changed

.github/workflows/CICD.yml

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: CICD
44
# spell-checker:ignore (env/flags) Awarnings Ccodegen Coverflow Cpanic Dwarnings RUSTDOCFLAGS RUSTFLAGS Zpanic CARGOFLAGS
55
# spell-checker:ignore (jargon) SHAs deps dequote softprops subshell toolchain fuzzers dedupe devel profdata
66
# spell-checker:ignore (people) Peltoche rivy dtolnay Anson dawidd
7-
# spell-checker:ignore (shell/tools) binutils choco clippy dmake esac fakeroot fdesc fdescfs gmake grcov halium lcov libclang libfuse libssl limactl mkdir nextest nocross pacman popd printf pushd redoxer rsync rustc rustfmt rustup shopt sccache utmpdump xargs
7+
# spell-checker:ignore (shell/tools) binutils choco clippy dmake esac fakeroot fdesc fdescfs gmake grcov halium lcov libclang libfuse libssl limactl mkdir nextest nocross pacman popd printf pushd redoxer rsync rustc rustfmt rustup shopt sccache utmpdump xargs zstd
88
# spell-checker:ignore (misc) aarch alnum armhf bindir busytest coreutils defconfig DESTDIR gecos getenforce gnueabihf issuecomment maint manpages msys multisize noconfirm nofeatures nullglob onexitbegin onexitend pell runtest Swatinem tempfile testsuite toybox uutils libsystemd codspeed
99

1010
env:
@@ -297,7 +297,6 @@ jobs:
297297
mv -T target target.cache
298298
fi
299299
# Check that we don't cross-build uudoc
300-
# also do not try to generate manpages for part of hashsum
301300
env CARGO_BUILD_TARGET=aarch64-unknown-linux-gnu make install-manpages PREFIX=/tmp/usr UTILS=true
302301
# build (host)
303302
make build
@@ -371,25 +370,19 @@ jobs:
371370
run: |
372371
set -x
373372
DESTDIR=/tmp/ make PROFILE=release MULTICALL=n install
374-
# Check that the utils are present
375-
test -f /tmp/usr/local/bin/hashsum
376-
# Check that hashsum symlinks are present
377-
test -h /tmp/usr/local/bin/b2sum
378-
test -h /tmp/usr/local/bin/md5sum
379-
test -h /tmp/usr/local/bin/sha1sum
380-
test -h /tmp/usr/local/bin/sha224sum
381-
test -h /tmp/usr/local/bin/sha256sum
382-
test -h /tmp/usr/local/bin/sha384sum
383-
test -h /tmp/usr/local/bin/sha512sum
373+
# Check that *sum are present
374+
for s in {md5,b2,sha1,sha224,sha256,sha384,sha512}sum
375+
do test -e /tmp/usr/local/bin/${s}
376+
done
384377
- name: "`make install MULTICALL=y LN=ln -svf`"
385378
shell: bash
386379
run: |
387380
set -x
388381
DESTDIR=/tmp/ make PROFILE=release MULTICALL=y LN="ln -svf" install
389-
# Check that relative symlinks of hashsum are present
390-
[ $(readlink /tmp/usr/local/bin/b2sum) = coreutils ]
391-
[ $(readlink /tmp/usr/local/bin/md5sum) = coreutils ]
392-
[ $(readlink /tmp/usr/local/bin/sha512sum) = coreutils ]
382+
# Check that symlinks of *sum are present
383+
for s in {md5,b2,sha1,sha224,sha256,sha384,sha512}sum
384+
do test $(readlink /tmp/usr/local/bin/${s}) = coreutils
385+
done
393386
- name: "`make UTILS=XXX`"
394387
shell: bash
395388
run: |
@@ -637,6 +630,8 @@ jobs:
637630
- uses: actions/checkout@v6
638631
with:
639632
persist-credentials: false
633+
- name: Avoid no space left on device
634+
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android &
640635
- uses: dtolnay/rust-toolchain@master
641636
with:
642637
toolchain: ${{ env.RUST_MIN_SRV }}
@@ -692,7 +687,7 @@ jobs:
692687
outputs TARGET_ARCH TARGET_OS
693688
# package name
694689
PKG_suffix=".tar.gz" ; case '${{ matrix.job.target }}' in *-pc-windows-*) PKG_suffix=".zip" ;; esac;
695-
PKG_BASENAME=${PROJECT_NAME}-${REF_TAG:-$REF_SHAS}-${{ matrix.job.target }}
690+
PKG_BASENAME=${PROJECT_NAME}-${{ matrix.job.target }}
696691
PKG_NAME=${PKG_BASENAME}${PKG_suffix}
697692
outputs PKG_suffix PKG_BASENAME PKG_NAME
698693
# deployable tag? (ie, leading "vM" or "M"; M == version number)
@@ -861,8 +856,6 @@ jobs:
861856
if: matrix.job.skip-tests != true
862857
shell: bash
863858
run: |
864-
command -v sudo && sudo rm -rf /usr/local/lib/android /usr/share/dotnet # avoid no space left
865-
df -h ||:
866859
## Test individual utilities
867860
${{ steps.vars.outputs.CARGO_CMD }} ${{ steps.vars.outputs.CARGO_CMD_OPTIONS }} test --target=${{ matrix.job.target }} \
868861
${{ matrix.job.cargo-options }} ${{ steps.dep_vars.outputs.CARGO_UTILITY_LIST_OPTIONS }}
@@ -897,25 +890,40 @@ jobs:
897890
*) tar czf '${{ steps.vars.outputs.PKG_NAME }}' '${{ steps.vars.outputs.PKG_BASENAME }}'/* ;;
898891
esac
899892
popd >/dev/null
893+
- name: Package manpages and completions
894+
if: matrix.job.target == 'x86_64-unknown-linux-gnu' && matrix.job.features == 'feat_os_unix,uudoc'
895+
run: |
896+
mkdir -p share/{man/man1,bash-completion/completions,fish/vendor_completions.d,zsh/site-functions,elvish/lib}
897+
_uudoc=target/${{ matrix.job.target }}/release/uudoc
898+
for bin in $('target/${{ matrix.job.target }}/release/coreutils' --list) coreutils;do
899+
${_uudoc} manpage ${bin} > share/man/man1/${bin}.1
900+
${_uudoc} completion ${bin} bash > share/bash-completion/completions/${bin}.bash
901+
${_uudoc} completion ${bin} fish > share/fish/vendor_completions.d/${bin}.fish
902+
${_uudoc} completion ${bin} zsh > share/zsh/site-functions/_${bin}
903+
${_uudoc} completion ${bin} elvish > share/elvish/lib/${bin}.elv
904+
done
905+
rm share/zsh/site-functions/_[ # not supported
906+
tar --zstd -cf docs.tar.zst share
900907
- name: Publish
901908
uses: softprops/action-gh-release@v2
902909
if: steps.vars.outputs.DEPLOY && matrix.job.skip-publish != true
903910
with:
904911
draft: true
905912
files: |
906913
${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
914+
docs.tar.zst
907915
env:
908916
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
909917
- name: Publish latest commit
910918
uses: softprops/action-gh-release@v2
911-
if: steps.vars.outputs.DEPLOY && matrix.job.skip-publish != true
919+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && matrix.job.skip-publish != true
912920
with:
913921
tag_name: latest-commit
914-
force_update: true
915922
draft: false
916923
prerelease: true
917924
files: |
918925
${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
926+
docs.tar.zst
919927
env:
920928
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
921929

@@ -1264,13 +1272,13 @@ jobs:
12641272
- uses: actions/checkout@v6
12651273
with:
12661274
persist-credentials: false
1275+
- name: Avoid no space left on device
1276+
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android &
12671277
- uses: dtolnay/rust-toolchain@stable
12681278
- uses: Swatinem/rust-cache@v2
12691279
- name: build and test all features individually
12701280
shell: bash
12711281
run: |
1272-
command -v sudo && sudo rm -rf /usr/local/lib/android /usr/share/dotnet # avoid no space left
1273-
df -h ||:
12741282
CARGO_FEATURES_OPTION='--features=${{ matrix.job.features }}' ;
12751283
for f in $(util/show-utils.sh ${CARGO_FEATURES_OPTION})
12761284
do

.github/workflows/GnuTests.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,6 @@ jobs:
233233
lima ls -laZ /etc/selinux
234234
lima sudo sestatus
235235
236-
# Ensure we're running in enforcing mode
237-
lima sudo setenforce 1
238-
lima getenforce
239-
240-
# Create test files with SELinux contexts for testing
241-
lima sudo mkdir -p /var/test_selinux
242-
lima sudo touch /var/test_selinux/test_file
243-
lima sudo chcon -t etc_t /var/test_selinux/test_file
244-
lima ls -Z /var/test_selinux/test_file # Verify context
245236
- name: Install dependencies in VM
246237
run: |
247238
lima sudo dnf -y update
@@ -267,8 +258,16 @@ jobs:
267258
lima bash -c "cd ~/work/uutils/ && echo 'Found SELinux tests:'; wc -l selinux-tests.txt"
268259
- name: Run GNU SELinux tests
269260
run: |
261+
# Ensure we're running in enforcing mode
270262
lima sudo setenforce 1
271263
lima getenforce
264+
265+
# Create test files with SELinux contexts for testing
266+
lima sudo mkdir -p /var/test_selinux
267+
lima sudo touch /var/test_selinux/test_file
268+
lima sudo chcon -t etc_t /var/test_selinux/test_file
269+
lima ls -Z /var/test_selinux/test_file # Verify context
270+
272271
lima cat /proc/filesystems
273272
lima bash -c "cd ~/work/uutils/ && bash util/run-gnu-test.sh \$(cat selinux-tests.txt)"
274273
- name: Extract testing info from individual logs into JSON

.github/workflows/freebsd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ jobs:
134134
with:
135135
persist-credentials: false
136136
- name: Avoid no space left on device (Ubuntu runner)
137-
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android
137+
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android &
138138
- uses: Swatinem/rust-cache@v2
139139
- name: Run sccache-cache
140140
uses: mozilla-actions/sccache-action@v0.0.9

.github/workflows/ignore-intermittent.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ tests/tty/tty-eof
88
tests/misc/stdbuf
99
tests/misc/usage_vs_getopt
1010
tests/misc/tee
11+
tests/tail/follow-name

.vscode/cspell.dictionaries/jargon.wordlist.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ inacc
184184
maint
185185
proc
186186
procs
187+
TOCTOU
187188

188189
# * constants
189190
xffff
@@ -202,6 +203,7 @@ nofield
202203
# * clippy
203204
uninlined
204205
nonminimal
206+
rposition
205207

206208
# * CPU/hardware features
207209
ASIMD

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ issues and writing documentation are just as important as writing code.
7878
We can't fix bugs we don't know about, so good issues are super helpful! Here
7979
are some tips for writing good issues:
8080

81-
- If you find a bug, make sure it's still a problem on the `main` branch.
81+
- If you find a bug, make sure it's still a problem on the [`main` branch](https://github.com/uutils/coreutils/releases/tag/latest-commit).
8282
- Search through the existing issues to see whether it has already been
8383
reported.
8484
- Make sure to include all relevant information, such as:
85-
- Which version of uutils did you check?
85+
- Which version or commit hash of uutils did you check?
8686
- Which version of GNU coreutils are you comparing with?
8787
- What platform are you on?
8888
- Provide a way to reliably reproduce the issue.
@@ -250,8 +250,8 @@ gitignore: add temporary files
250250
- It's up to you whether you want to use `git merge main` or
251251
`git rebase main`.
252252
- Feel free to ask for help with merge conflicts.
253-
- You do not need to ping maintainers to request a review, but it's fine to do
254-
so if you don't get a response within a few days.
253+
- You do not need to ping maintainers to request a review immediately after submission. If you do not get a response to your patch within a few days, it is fine to request a review.
254+
- If after a week your patch has still not been reviewed, we recommend that you ping the maintainers on our Discord channel in `#coreutils-chat`.
255255

256256
## Platforms
257257

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ uutests.workspace = true
549549
uucore = { workspace = true, features = [
550550
"mode",
551551
"entries",
552+
"pipes",
552553
"process",
553554
"signals",
554555
"utmpx",

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ options might be missing or different behavior might be experienced.
2929

3030
<div class="oranda-hide">
3131

32-
We provide prebuilt binaries at https://github.com/uutils/coreutils/releases/latest .
33-
It is recommended to install from main branch if you install from source.
32+
We provide prebuilt binaries, manpages, and shell completions from main branch at https://github.com/uutils/coreutils/releases/tag/latest-commit .
33+
The latest stable tag https://github.com/uutils/coreutils/releases/latest exists only for reproducible products and packagers.
34+
You should use binary from latest commit generally.
3435

3536
</div>
3637

src/uu/comm/src/comm.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ pub fn are_files_identical(path1: &Path, path2: &Path) -> io::Result<bool> {
136136
return Ok(false);
137137
}
138138

139+
// only proceed if both are regular files
140+
if !metadata1.is_file() || !metadata2.is_file() {
141+
return Ok(false);
142+
}
143+
139144
let file1 = File::open(path1)?;
140145
let file2 = File::open(path2)?;
141146

src/uu/cp/benches/cp_bench.rs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,25 @@ fn cp_preserve_metadata(
8282

8383
#[divan::bench(args = [16])]
8484
fn cp_large_file(bencher: Bencher, size_mb: usize) {
85-
let temp_dir = TempDir::new().unwrap();
86-
let source = temp_dir.path().join("source.bin");
87-
let dest = temp_dir.path().join("dest.bin");
88-
89-
binary_data::create_file(&source, size_mb, b'x');
90-
91-
let source_str = source.to_str().unwrap();
92-
let dest_str = dest.to_str().unwrap();
93-
94-
bencher.bench(|| {
95-
fs_utils::remove_path(&dest);
96-
97-
black_box(run_util_function(uumain, &[source_str, dest_str]));
98-
});
85+
bencher
86+
.with_inputs(|| {
87+
let temp_dir = TempDir::new().unwrap();
88+
let source = temp_dir.path().join("source.bin");
89+
binary_data::create_file(&source, size_mb, b'x');
90+
(temp_dir, source)
91+
})
92+
.counter(divan::counter::BytesCount::new(size_mb * 1024 * 1024))
93+
.bench_values(|(temp_dir, source)| {
94+
// Use unique destination name to avoid filesystem allocation variance
95+
let dest = temp_dir.path().join(format!(
96+
"dest_{}.bin",
97+
std::ptr::addr_of!(temp_dir) as usize
98+
));
99+
let source_str = source.to_str().unwrap();
100+
let dest_str = dest.to_str().unwrap();
101+
102+
black_box(run_util_function(uumain, &[source_str, dest_str]));
103+
});
99104
}
100105

101106
fn main() {

0 commit comments

Comments
 (0)