Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .github/workflows/l10n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ jobs:
brew install coreutils
;;
esac
- name: Build with platform features
shell: bash
run: |
## Build with platform-specific features to enable l10n functionality
cargo build --features ${{ matrix.job.features }}
- name: Test l10n functionality
shell: bash
run: |
Expand Down Expand Up @@ -144,6 +149,10 @@ jobs:
sudo apt-get -y update ; sudo apt-get -y install libselinux1-dev
sudo locale-gen --keep-existing fr_FR.UTF-8
locale -a | grep -i fr || exit 1
- name: Build coreutils with clap localization support
shell: bash
run: |
cargo build --features feat_os_unix --bin coreutils
- name: Test English clap error localization
shell: bash
run: |
Expand Down Expand Up @@ -312,6 +321,11 @@ jobs:
## Generate French locale for testing
sudo locale-gen --keep-existing fr_FR.UTF-8
locale -a | grep -i fr || echo "French locale not found, continuing anyway"
- name: Build coreutils with l10n support
shell: bash
run: |
## Build coreutils with Unix features and l10n support
cargo build --features feat_os_unix --bin coreutils
- name: Test French localization
shell: bash
run: |
Expand Down Expand Up @@ -692,7 +706,7 @@ jobs:
mkdir -p "$CARGO_INSTALL_DIR"

# Install using cargo with l10n features
cargo install --path . --features "ls,cat,touch" --root "$CARGO_INSTALL_DIR" --locked
cargo install --path . --features ${{ matrix.job.features }} --root "$CARGO_INSTALL_DIR" --locked

# Verify installation
echo "Testing cargo-installed binaries..."
Expand Down Expand Up @@ -1365,3 +1379,11 @@ jobs:
echo "::warning::More locales than expected ($total_match_count entries)"
echo "This might be expected for utility + uucore locales"
fi

l10n_locale_embedding_regression_test:
name: L10n/Locale Embedding Regression Test
runs-on: ubuntu-latest
needs: [l10n_locale_embedding_cat, l10n_locale_embedding_ls, l10n_locale_embedding_multicall, l10n_locale_embedding_cargo_install]
steps:
- name: All locale embedding tests passed
run: echo "✓ All locale embedding tests passed successfully"
34 changes: 0 additions & 34 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,40 +266,6 @@ jobs:
# 2. the makefile doesn't try to install libstdbuf even though stdbuf is skipped
DESTDIR=/tmp/ make SKIP_UTILS="stdbuf" install

# keep this job minimal to avoid have many duplicated build with CICD
build_makefile-other:
name: Build/Makefile
runs-on: ${{ matrix.job.os }}
env:
CARGO_INCREMENTAL: 0
strategy:
fail-fast: false
matrix:
job:
- { os: windows-latest , features: feat_os_windows }
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
id: sccache-setup
uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- name: Export sccache
if: steps.sccache-setup.outcome == 'success'
run: |
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
- name: "`make build`"
shell: bash
run: |
set -x
# Check that we exclude unix programs to avoid build failure
make PREFIX=/tmp/usr MULTICALL=y COMPLETIONS=n MANPAGES=n LOCALES=n \
SKIP_UTILS="arch b2sum base32 base64 basename basenc cat cksum comm cp csplit cut date dd df dir dircolors dirname du echo env expand expr factor false fmt fold head hostname join link ln ls md5sum mkdir mktemp more mv nl nproc numfmt od paste pr printenv printf ptx pwd readlink realpath rm rmdir seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf sleep sort split sum sync tac tail tee test touch tr truncate tsort uname unexpand uniq unlink vdir wc whoami yes"
target/debug/coreutils.exe true

test_busybox:
name: Tests/BusyBox test suite
runs-on: ${{ matrix.job.os }}
Expand Down
12 changes: 0 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ rayon = "1.10"
regex = "1.10.4"
rlimit = "0.11.0"
rstest = "0.26.0"
rstest_reuse = "0.7.0"
rustc-hash = "2.1.1"
rust-ini = "0.21.0"
same-file = "1.0.6"
Expand Down Expand Up @@ -641,7 +640,6 @@ uucore = { workspace = true, features = [
walkdir.workspace = true
hex-literal = "1.0.0"
rstest.workspace = true
rstest_reuse.workspace = true

[target.'cfg(unix)'.dev-dependencies]
nix = { workspace = true, features = [
Expand Down
41 changes: 27 additions & 14 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,31 +62,44 @@ TOYBOX_ROOT := $(BASEDIR)/tmp
TOYBOX_VER := 0.8.12
TOYBOX_SRC := $(TOYBOX_ROOT)/toybox-$(TOYBOX_VER)

# Detect the target system
# See https://doc.rust-lang.org/beta/rustc/platform-support.html
# todo: support building wasm
OS := $(or $(CARGO_BUILD_TARGET),$(shell rustc --print host-tuple))
#------------------------------------------------------------------------
# Detect the host system.
# On Windows uname -s might return MINGW_NT-* or CYGWIN_NT-*.
# Otherwise let it default to the kernel name returned by uname -s
# (Linux, Darwin, FreeBSD, …).
#------------------------------------------------------------------------
OS ?= $(shell uname -s)

# Windows does not allow symlink by default.
# Allow to override LN for AppArmor.
ifneq (,$(findstring windows,$(OS)))
ifneq (,$(findstring _NT,$(OS)))
LN ?= ln -f
endif
LN ?= ln -sf

# Possible programs
PROGS := \
$(shell sed -n '/feat_Tier1 = \[/,/\]/p' Cargo.toml | sed '1d;2d' |tr -d '],"\n')\
$(shell sed -n '/feat_common_core = \[/,/\]/p' Cargo.toml | sed '1d' |tr -d '],"\n')

UNIX_PROGS := \
$(shell sed -n '/feat_require_unix_core = \[/,/\]/p' Cargo.toml | sed '1d' |tr -d '],"\n') \
hostid \
pinky \
stdbuf \
uptime \
users \
who

SELINUX_PROGS := \
chcon \
runcon

$(info Detected OS = $(OS))

ifeq (,$(findstring windows,$(OS)))
FEATURE_EXTRACT_UTILS := feat_os_unix
else
FEATURE_EXTRACT_UTILS := feat_Tier1
ifeq (,$(findstring MINGW,$(OS)))
PROGS += $(UNIX_PROGS)
endif
PROGS := $(shell cargo tree --depth 1 --features $(FEATURE_EXTRACT_UTILS) --format "{p}" --prefix none | sed -E -n 's/^uu_([^ ]+).*/\1/p')

ifeq ($(SELINUX_ENABLED),1)
PROGS += $(SELINUX_PROGS)
endif
Expand All @@ -101,7 +114,7 @@ endif
# Programs with usable tests

TESTS := \
$(sort $(filter $(UTILS),$(PROGS) $(SELINUX_PROGS)))
$(sort $(filter $(UTILS),$(PROGS) $(UNIX_PROGS) $(SELINUX_PROGS)))

TEST_NO_FAIL_FAST :=
TEST_SPEC_FEATURE :=
Expand Down Expand Up @@ -275,7 +288,7 @@ install: build install-manpages install-completions install-locales
mkdir -p $(INSTALLDIR_BIN)
ifneq (,$(and $(findstring stdbuf,$(UTILS)),$(findstring feat_external_libstdbuf,$(CARGOFLAGS))))
mkdir -p $(DESTDIR)$(LIBSTDBUF_DIR)
ifneq (,$(findstring cygwin,$(OS)))
ifneq (,$(findstring CYGWIN,$(OS)))
$(INSTALL) -m 755 $(BUILDDIR)/deps/stdbuf.dll $(DESTDIR)$(LIBSTDBUF_DIR)/libstdbuf.dll
else
$(INSTALL) -m 755 $(BUILDDIR)/deps/libstdbuf.* $(DESTDIR)$(LIBSTDBUF_DIR)/
Expand All @@ -295,7 +308,7 @@ else
endif

uninstall:
ifeq (,$(findstring windows,$(OS)))
ifeq (,$(findstring MINGW,$(OS)))
rm -f $(DESTDIR)$(LIBSTDBUF_DIR)/libstdbuf.*
-rm -d $(DESTDIR)$(LIBSTDBUF_DIR) 2>/dev/null || true
endif
Expand Down
10 changes: 7 additions & 3 deletions src/uu/b2sum/src/b2sum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ use clap::Command;

use uu_checksum_common::{standalone_checksum_app_with_length, standalone_with_length_main};

use uucore::checksum::{AlgoKind, calculate_blake_length_str};
use uucore::checksum::{AlgoKind, calculate_blake2b_length_str};
use uucore::error::UResult;
use uucore::translate;

#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let calculate_blake2b_length = |s: &str| calculate_blake_length_str(AlgoKind::Blake2b, s);
standalone_with_length_main(AlgoKind::Blake2b, uu_app(), args, calculate_blake2b_length)
standalone_with_length_main(
AlgoKind::Blake2b,
uu_app(),
args,
calculate_blake2b_length_str,
)
}

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion src/uu/cksum/benches/cksum_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bench_algorithm!(cksum_sha224, "sha224");
bench_algorithm!(cksum_sha256, "sha256");
bench_algorithm!(cksum_sha384, "sha384");
bench_algorithm!(cksum_sha512, "sha512");
bench_algorithm!(cksum_blake3, "blake3");
// broken. benchmarking error messages issues/10002 bench_algorithm!(cksum_blake3, "blake3");
bench_shake_algorithm!(cksum_shake128, "shake128", Shake128);
bench_shake_algorithm!(cksum_shake256, "shake256", Shake256);

Expand Down
8 changes: 3 additions & 5 deletions src/uu/cksum/src/cksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use uu_checksum_common::{ChecksumCommand, checksum_main, default_checksum_app, o

use uucore::checksum::compute::OutputFormat;
use uucore::checksum::{
AlgoKind, ChecksumError, calculate_blake_length_str, sanitize_sha2_sha3_length_str,
AlgoKind, ChecksumError, calculate_blake2b_length_str, sanitize_sha2_sha3_length_str,
};
use uucore::error::UResult;
use uucore::hardware::{HasHardwareFeatures as _, SimdPolicy};
Expand Down Expand Up @@ -67,10 +67,8 @@ fn maybe_sanitize_length(
Err(_) => Err(ChecksumError::InvalidLength(len.into()).into()),
},

// For BLAKE, if a length is provided, validate it.
(Some(algo @ (AlgoKind::Blake2b | AlgoKind::Blake3)), Some(len)) => {
calculate_blake_length_str(algo, len)
}
// For BLAKE2b, if a length is provided, validate it.
(Some(AlgoKind::Blake2b), Some(len)) => calculate_blake2b_length_str(len),

// For any other provided algorithm, check if length is 0.
// Otherwise, this is an error.
Expand Down
Loading
Loading