Skip to content

Commit 4556d29

Browse files
authored
Merge branch 'main' into rm-one-file-system
2 parents 6918d84 + cbbff30 commit 4556d29

51 files changed

Lines changed: 821 additions & 170 deletions

Some content is hidden

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

.github/workflows/CICD.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ jobs:
298298
fi
299299
# Check that we don't cross-build uudoc
300300
env CARGO_BUILD_TARGET=aarch64-unknown-linux-gnu make install-manpages PREFIX=/tmp/usr UTILS=true
301+
# We don't build coreutils without MULTICALL=y
302+
! test -e target/debug/coreutils
301303
# build (host)
302304
make build
303305
echo "Check that target directory will be ignored by backup tools"
@@ -1286,7 +1288,6 @@ jobs:
12861288
- uses: actions/checkout@v6
12871289
with:
12881290
persist-credentials: false
1289-
- uses: dtolnay/rust-toolchain@stable
12901291
- name: Setup Lima
12911292
uses: lima-vm/lima-actions/setup@v1
12921293
id: lima-actions-setup
@@ -1301,17 +1302,17 @@ jobs:
13011302
- name: Setup Rust and other build deps in VM
13021303
run: |
13031304
lima sudo dnf install gcc g++ git rustup libselinux-devel clang-devel attr -y
1304-
lima rustup-init -y --default-toolchain stable
1305+
lima rustup-init -y --default-toolchain stable --profile minimal -c clippy
13051306
- name: Verify SELinux Status
13061307
run: |
13071308
lima getenforce
13081309
lima ls -laZ /etc/selinux
13091310
- name: Build and Test with SELinux
13101311
run: |
13111312
lima ls
1312-
lima bash -c "cd work && cargo test --features 'feat_selinux'"
1313+
lima bash -c "cd work && cargo test --features 'feat_selinux' --no-default-features"
13131314
- name: Lint with SELinux
1314-
run: lima bash -c "cd work && cargo clippy --all-targets --features 'feat_selinux' -- -D warnings"
1315+
run: lima bash -c "cd work && cargo clippy --all-targets --features 'feat_selinux' --no-default-features -- -D warnings"
13151316

13161317
test_selinux_stubs:
13171318
name: Build/SELinux-Stubs (Non-Linux)
@@ -1354,6 +1355,6 @@ jobs:
13541355
- name: Install strace
13551356
run: sudo apt-get update && sudo apt-get install -y strace
13561357
- name: Build utilities with safe traversal
1357-
run: cargo build --release -p uu_rm -p uu_chmod -p uu_chown -p uu_chgrp -p uu_mv -p uu_du
1358+
run: cargo build --profile=release-small -p uu_rm -p uu_chmod -p uu_chown -p uu_chgrp -p uu_mv -p uu_du
13581359
- name: Run safe traversal verification
13591360
run: ./util/check-safe-traversal.sh

.github/workflows/android.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ concurrency:
2222
env:
2323
TERMUX: v0.118.0
2424
KEY_POSTFIX: nextest+rustc-hash+adb+sshd+upgrade+XGB+inc18
25-
COMMON_EMULATOR_OPTIONS: -no-window -noaudio -no-boot-anim -camera-back none -gpu off
25+
COMMON_EMULATOR_OPTIONS: -no-metrics -no-window -noaudio -no-boot-anim -camera-back none -gpu off
2626
EMULATOR_DISK_SIZE: 12GB
2727
EMULATOR_HEAP_SIZE: 2048M
2828
EMULATOR_BOOT_TIMEOUT: 1200 # 20min
@@ -39,7 +39,7 @@ jobs:
3939
ram: [4096]
4040
api-level: [28]
4141
target: [google_apis_playstore]
42-
arch: [x86, x86_64] # , arm64-v8a
42+
arch: [x86_64] # ,x86 ,arm64-v8a
4343
runs-on: ${{ matrix.os }}
4444
env:
4545
EMULATOR_RAM_SIZE: ${{ matrix.ram }}
@@ -166,7 +166,7 @@ jobs:
166166
disk-size: ${{ env.EMULATOR_DISK_SIZE }}
167167
cores: ${{ env.EMULATOR_CORES }}
168168
force-avd-creation: false
169-
emulator-options: ${{ env.COMMON_EMULATOR_OPTIONS }} -no-metrics -no-snapshot-save -snapshot ${{ env.AVD_CACHE_KEY }}
169+
emulator-options: ${{ env.COMMON_EMULATOR_OPTIONS }} -no-snapshot-save -snapshot ${{ env.AVD_CACHE_KEY }}
170170
emulator-boot-timeout: ${{ env.EMULATOR_BOOT_TIMEOUT }}
171171
# This is not a usual script. Every line is executed in a separate shell with `sh -c`. If
172172
# one of the lines returns with error the whole script is failed (like running a script with

.github/workflows/benchmarks.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ubuntu-latest
2323
strategy:
2424
matrix:
25-
type: [performance, memory]
25+
type: [performance] # , memory] # memory profile disabled due to variance
2626
package: [
2727
uu_base64,
2828
uu_cksum,
@@ -62,6 +62,14 @@ jobs:
6262
- name: Run sccache-cache
6363
uses: mozilla-actions/sccache-action@v0.0.9
6464

65+
- name: Install locales
66+
shell: bash
67+
run: |
68+
sudo apt-get update
69+
sudo apt-get install -y locales
70+
sudo locale-gen fr_FR.UTF-8
71+
sudo update-locale
72+
6573
- name: Install cargo-codspeed
6674
shell: bash
6775
run: cargo install cargo-codspeed --locked

.github/workflows/l10n.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ jobs:
735735
run: |
736736
## Download additional locale files from coreutils-l10n repository
737737
echo "Downloading additional locale files from coreutils-l10n..."
738-
git clone https://github.com/uutils/coreutils-l10n.git coreutils-l10n-repo
738+
git clone --depth=1 https://github.com/uutils/coreutils-l10n.git coreutils-l10n-repo
739739
740740
# Create installation directory
741741
CARGO_INSTALL_DIR="$PWD/cargo-install-dir"

Cargo.lock

Lines changed: 11 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ indicatif = "0.18.0"
338338
itertools = "0.14.0"
339339
jiff = "0.2.18"
340340
libc = "0.2.172"
341-
linux-raw-sys = "0.12"
342341
lscolors = { version = "0.21.0", default-features = false, features = [
343342
"gnu_legacy",
344343
] }

GNUmakefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,11 @@ endif
327327
build-coreutils:
328328
${CARGO} build ${CARGOFLAGS} --features "${EXES} $(BUILD_SPEC_FEATURE)" ${PROFILE_CMD} --no-default-features
329329

330-
build: build-coreutils build-pkgs locales
330+
ifeq (${MULTICALL}, y)
331+
build: build-coreutils locales
332+
else
333+
build: build-pkgs locales
334+
endif
331335

332336
$(foreach test,$(UTILS),$(eval $(call TEST_BUSYBOX,$(test))))
333337

deny.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ skip = [
9595
{ name = "nom", version = "7.1.3" },
9696
# const-random-macro, rand_core
9797
{ name = "getrandom", version = "0.2.15" },
98-
# getrandom, mio
99-
{ name = "wasi", version = "0.11.0+wasi-snapshot-preview1" },
10098
# num-bigint, num-prime, phf_generator
10199
{ name = "rand", version = "0.8.5" },
102100
# rand
@@ -107,8 +105,6 @@ skip = [
107105
{ name = "zerocopy", version = "0.7.35" },
108106
# zerocopy
109107
{ name = "zerocopy-derive", version = "0.7.35" },
110-
# rustix
111-
{ name = "linux-raw-sys", version = "0.11.0" },
112108
# crossterm
113109
{ name = "signal-hook", version = "0.3.18" },
114110
]

src/uu/chcon/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ workspace = true
1717
[lib]
1818
path = "src/chcon.rs"
1919

20-
[dependencies]
20+
[target.'cfg(target_os = "linux")'.dependencies] # todo: block fetching crates without feat_selinux
2121
clap = { workspace = true }
2222
uucore = { workspace = true, features = ["entries", "fs", "perms"] }
2323
selinux = { workspace = true }

src/uu/comm/src/comm.rs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use std::cmp::Ordering;
99
use std::ffi::OsString;
1010
use std::fs::{File, metadata};
11-
use std::io::{self, BufRead, BufReader, Read, StdinLock, stdin};
11+
use std::io::{self, BufRead, BufReader, BufWriter, Read, StdinLock, Write, stdin};
1212
use std::path::Path;
1313
use uucore::display::Quotable;
1414
use uucore::error::{FromIo, UResult, USimpleError};
@@ -184,13 +184,25 @@ pub fn are_files_identical(path1: &Path, path2: &Path) -> io::Result<bool> {
184184
}
185185
}
186186

187+
fn write_line_with_delimiter<W: Write>(writer: &mut W, delim: &[u8], line: &[u8]) -> UResult<()> {
188+
writer
189+
.write_all(delim)
190+
.map_err_context(|| translate!("comm-error-write"))?;
191+
writer
192+
.write_all(line)
193+
.map_err_context(|| translate!("comm-error-write"))?;
194+
Ok(())
195+
}
196+
187197
fn comm(a: &mut LineReader, b: &mut LineReader, delim: &str, opts: &ArgMatches) -> UResult<()> {
188198
let width_col_1 = usize::from(!opts.get_flag(options::COLUMN_1));
189199
let width_col_2 = usize::from(!opts.get_flag(options::COLUMN_2));
190200

191201
let delim_col_2 = delim.repeat(width_col_1);
192202
let delim_col_3 = delim.repeat(width_col_1 + width_col_2);
193203

204+
let mut writer = BufWriter::new(io::stdout().lock());
205+
194206
let ra = &mut Vec::new();
195207
let mut na = a.read_line(ra);
196208
let rb = &mut Vec::new();
@@ -239,7 +251,9 @@ fn comm(a: &mut LineReader, b: &mut LineReader, delim: &str, opts: &ArgMatches)
239251
break;
240252
}
241253
if !opts.get_flag(options::COLUMN_1) {
242-
print!("{}", String::from_utf8_lossy(ra));
254+
writer
255+
.write_all(ra)
256+
.map_err_context(|| translate!("comm-error-write"))?;
243257
}
244258
ra.clear();
245259
na = a.read_line(ra);
@@ -250,7 +264,7 @@ fn comm(a: &mut LineReader, b: &mut LineReader, delim: &str, opts: &ArgMatches)
250264
break;
251265
}
252266
if !opts.get_flag(options::COLUMN_2) {
253-
print!("{delim_col_2}{}", String::from_utf8_lossy(rb));
267+
write_line_with_delimiter(&mut writer, delim_col_2.as_bytes(), rb)?;
254268
}
255269
rb.clear();
256270
nb = b.read_line(rb);
@@ -262,7 +276,7 @@ fn comm(a: &mut LineReader, b: &mut LineReader, delim: &str, opts: &ArgMatches)
262276
break;
263277
}
264278
if !opts.get_flag(options::COLUMN_3) {
265-
print!("{delim_col_3}{}", String::from_utf8_lossy(ra));
279+
write_line_with_delimiter(&mut writer, delim_col_3.as_bytes(), ra)?;
266280
}
267281
ra.clear();
268282
rb.clear();
@@ -280,12 +294,16 @@ fn comm(a: &mut LineReader, b: &mut LineReader, delim: &str, opts: &ArgMatches)
280294

281295
if opts.get_flag(options::TOTAL) {
282296
let line_ending = LineEnding::from_zero_flag(opts.get_flag(options::ZERO_TERMINATED));
283-
print!(
297+
write!(
298+
writer,
284299
"{total_col_1}{delim}{total_col_2}{delim}{total_col_3}{delim}{}{line_ending}",
285300
translate!("comm-total")
286-
);
301+
)
302+
.map_err_context(|| translate!("comm-error-write"))?;
287303
}
288304

305+
writer.flush().ok();
306+
289307
if should_check_order && (checker1.has_error || checker2.has_error) {
290308
// Print the input error message once at the end
291309
if input_error {

0 commit comments

Comments
 (0)